Re: need help with timezone conversion (unexpected side effect of time.mktime ??)

2008-06-03 Thread Ivan Velev
time is near the "daylight saving time change" moment) On Jun 3, 6:01 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 3 Jun, 16:12, Ivan Velev <[EMAIL PROTECTED]> wrote: > > > > > Minimal example below - it gives me different output if I comment / > >

Re: Best way to modify code without breaking stuff.

2008-06-04 Thread Ivan Illarionov
best way > to accomplish this? Version control system. http://en.wikipedia.org/wiki/List_of_revision_control_software Make your module a versioned repository. Make your changes in different place, then commit them. I use SVN and mercurial. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: printf in python

2008-06-04 Thread Ivan Illarionov
ile__))) sys.argv = [sys.argv[0], 'build_ext', '-i'] setup(ext_modules = [Extension('_hello', ["hello.c"])]) 3. run "python buildme.py" That's all. >>> from _hello import hello >>> hello() Hello world! -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to extend Python with C: undefined reference to `Py_BuildValue'

2008-06-04 Thread Ivan Illarionov
ot;); Py_RETURN_NONE; } static PyMethodDef functions[] = { {"hello",(PyCFunction)hello, METH_NOARGS}, {NULL, NULL, 0, NULL}, }; DL_EXPORT(void) init_hello(void) { Py_InitModule("_hello", functions); } 2. create 'buildme.py' file with this conten

Re: printf in python

2008-06-04 Thread Ivan Illarionov
On Wed, 04 Jun 2008 14:10:51 +, Ivan Illarionov wrote: > On Mon, 02 Jun 2008 00:32:33 -0700, gianluca wrote: > >> Hy, I've a problem with may python library generated with swig from C >> code. I works and I can access all function but a simèple function >> tha

Re: can python do some kernel stuff?

2008-06-04 Thread Ivan Illarionov
: "c" (hello_str), "d" (hello_len) /* input */ ); #else printf("Hello world!\n"); #endif Py_RETURN_NONE; } static PyMethodDef functions[] = { {"hello",(PyCFunction)hello, METH_NOARGS}, {NULL, NULL, 0, NULL}, }; DL_EXPORT(voi

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
Can I do this? > > My system, in case it matters, is Fedora Linux. > > Thanks in advance. There is -c option for setup.py build and setup.py build_ext. If it doesn't work for your compiler you probably have to build your extensions manually. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
Can I do this? > > My system, in case it matters, is Fedora Linux. > > Thanks in advance. There is -c option for setup.py build and setup.py build_ext. If it doesn't work for your compiler you probably have to build your extensions manually. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending Python with C: Can I specify another C compiler?

2008-06-04 Thread Ivan Illarionov
Can I do this? > > My system, in case it matters, is Fedora Linux. > > Thanks in advance. There is -c option for setup.py build and setup.py build_ext. If it doesn't work for your compiler you probably have to build your extensions manually. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: can python do some kernel stuff?

2008-06-04 Thread Ivan Illarionov
Python would be the first PID. Isn't it more practical? Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
;tuple%s" % i, coord) for i, coord in izip(xrange(1,11), >>> repeat(coords))) >>> tuple1 ((1, 1, 1), (1, 2, 1), (1, 3, 1), (1, 4, 1), (2, 1, 1), (2, 2, 1), (2, 3, 1), (2 , 4, 1), (3, 1, 1), (3, 2, 1), (3, 3, 1), (3, 4, 1), (4, 1, 1), (4, 2, 1), (4, 3 , 1), (4, 4, 1)) Does this help? But I don't understand why you need this? Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
On 5 июн, 18:19, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 5, 3:49 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > > On 5 ÉÀÎ, 01:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > Hi Ev

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
On 5 июн, 18:19, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jun 5, 3:49 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > > On 5 ÉÀÎ, 01:57, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > Hi Ev

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
On 5 июн, 18:56, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On 5 июн, 18:19, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > On Jun 5, 3:49 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > On 5 ÉÀÎ, 01:57, &quo

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
On 5 июн, 19:38, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 5, 11:21 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > > On 5 июн, 18:56, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > On 5 июн, 18:19, "[EMAIL PROTECTED]" &l

Re: Tuples part 2

2008-06-05 Thread Ivan Illarionov
On 5 июн, 21:22, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 5, 11:48 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > > > > On 5 июн, 19:38, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > On Jun 5, 11:21 am, Ivan Illarionov <[EMAIL

Re: Image Processing (batch)

2008-06-06 Thread Ivan Illarionov
ave some working snippets of code that do handle fonts nicely with PIL images, read and parse OpenType tables, but I can't publish it because it's optimized for my private needs like only two languages: Russian and English. I had to rewrite PIL's FreeType layer from scratch to do what I want. You can do the same. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: need help with timezone conversion (unexpected side effect of time.mktime ??)

2008-06-08 Thread Ivan Velev
onversions, I was not able to do anything using datetime module - it seems that one needs to define his own set of timezones (+ all the details) to get it working ... Am I wrong ? Can you show me how do accomplish the same conversion using datetime module ? Thanks again, Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: need help with timezone conversion (unexpected side effect of time.mktime ??)

2008-06-09 Thread Ivan Velev
e that comes to mind is python-dateutil, > but I think there are others. Thanks I will try it. Once again, thanks for your helpfull responses ! Ivan On Jun 9, 12:11 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 9 Jun, 07:40, Ivan Velev <[EMAIL PROTECTED]> wrote: > > >

Re: Dynamic HTML from Python Script

2008-06-11 Thread Ivan Illarionov
app to Apache web server http://www.djangoproject.com/documentation/modpython/ http://www.djangoproject.com/documentation/fastcgi/ Hope this Django/AJAX introduction is helpfull Please note that this code is extremely simplified you probably need to learn more about Django and AJAX/Javascript by yourself Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: advanced listcomprehenions?

2008-06-20 Thread Ivan Illarionov
ometable[i% > 15] is going beat something like this hands-down. > > This is coding for fun not profit. > > -- > Duncan Boothhttp://kupuguy.blogspot.com I can't resist... [[i,"Fizz","Buzz","FizzBuzz"][(not i%3)+(not i%5)*2] for i in range(1, 101)] Ivan -- http://mail.python.org/mailman/listinfo/python-list

PyXMPP and GTalk

2008-04-03 Thread Ivan Chernetsky
Hello! Here is the example from PyXMPP package: http://pyxmpp.jajcus.net/trac/browser/trunk/examples/echobot.py And here is output: -- http://mail.python.org/mailman/listinfo/python-list

Re: wrapping C functions in python

2008-04-10 Thread Ivan Illarionov
27;ll have almost instant C arrays from Python data and vice versa. 1: http://effbot.org/downloads/Imaging-1.1.6.tar.gz 2: http://docs.python.org/api/buffer-structs.html Regards, -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: get array element

2008-04-10 Thread Ivan Illarionov
On Apr 10, 9:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have an array, and I would like to get the indice value. > > a = array([13,14,15,16]) > > I would like something like a.getindice(15) > > If I want 15 it would return 2 >>> a = array('i', [13,14,15,16]) >>> a.index(15) 2 -- ht

Re: Module Conflicts

2008-04-10 Thread Ivan Illarionov
m without renaming my math.py file? Yes, if you are using Python 2.5 from __future__ import absolute import after this `import math` will always import standard math module and `from . import math` will import your module. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Module Conflicts

2008-04-10 Thread Ivan Illarionov
On Apr 11, 12:31 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Apr 10, 2:33 am, Jose <[EMAIL PROTECTED]> wrote: > > > I have a module named math.py in a package with some class > > definitions. I am trying to import the standard python math module > >

Re: Rounding a number to nearest even

2008-04-11 Thread Ivan Illarionov
On Apr 11, 2:14 pm, bdsatish <[EMAIL PROTECTED]> wrote: > The built-in function round( ) will always "round up", that is 1.5 is > rounded to 2.0 and 2.5 is rounded to 3.0. > > If I want to round to the nearest even, that is > > my_round(1.5) = 2# As expected > my_round(2.5) = 2# Not

Re: Rounding a number to nearest even

2008-04-11 Thread Ivan Illarionov
On Apr 11, 5:49 pm, hdante <[EMAIL PROTECTED]> wrote: > On Apr 11, 9:45 am, bdsatish <[EMAIL PROTECTED]> wrote: > > > > > On Apr 11, 5:33 pm, bdsatish <[EMAIL PROTECTED]> wrote: > > > > HI Gerard, > > > > I think you've taken it to the best possible implementation. Thanks ! > > > On Apr 11, 5:14 pm

Re: C to python conversion

2008-04-13 Thread Ivan Illarionov
itialized to NULs, because only 3 bytes > # are filled but 6 bytes are written. > os.write(_fd, buf) > buf_ret = os.read(_fd, 6) > > -- > Gabriel Genellina The easiest way is to use struct: START = 0x33 RETURN_START = 0x22 ADDR = 0x01 WRITE_CMD = 0x03 ALL_CMD = 0xFF buf = struct.pack('3b3x', START, ADDR, WRITE_CMD) os.write(_fd, buf) buf_ret = os.read(_fd, 6) And, definitely, no need for ctypes here. -- Ivan Illarionov -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a way to include Pyhtho scripting INSIDE a python program

2008-04-13 Thread Ivan Illarionov
27;s string inside function definition, and exec it. You might want to disable words like `import`, `exec` and `eval` in user's code because it's a big security risk. -- Ivan Illarionov -- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting math problem

2008-04-13 Thread Ivan Illarionov
buf[i] = 0 else: for i in range(start, start - pitch * step, -pitch): buf[i] = 0 x += xdir y += step * ydir Please, tell me that I'm wrong and it's really possible to draw lines, do scan-conversion and so on with such a cool succint constructs! -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a way to include Pyhtho scripting INSIDE a python program

2008-04-13 Thread Ivan Illarionov
On Apr 13, 8:20 pm, Bryan Oakley <[EMAIL PROTECTED]> wrote: > Ivan Illarionov wrote: > > You don't need to envoke another interpreter. > > Python can interpret arbitrary python code with exec statement. > > Wrap user's string inside function definition, and exe

Re: Java or C++?

2008-04-15 Thread Ivan Illarionov
On 15 апр, 07:46, Brian Vanderburg II <[EMAIL PROTECTED]> wrote: [...] > C has the advantage that it does not to anything behind your back. This > is very useful especially for any form of system development or where > you must know exactly what is going on. It is still possible to do > 'object o

Re: index of list of lists

2008-04-17 Thread Ivan Illarionov
er, don't judge me). > is the list.index the wrong approach? should I use numpy, numarray, > something else? can anyone, be kind and help me with this? You probably need something like this: [x for x, y, z in someList if x == 'somestring'] or this: for x, y, z in someList:

Re: Request a short code review

2008-04-17 Thread Ivan Illarionov
return self.output_random([x for x in self.lesson_data["lessons"] if x["type"] == type]) return self.output_random(self.lesson_data["lessons"]) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: py3k s***s

2008-04-18 Thread Ivan Illarionov
worry about Django. Python 3000 port has already started [1]. And the assumption that "to support both is not realistic" may be wrong [2] in this case. [1] http://wiki.python.org/moin/PortingDjangoTo3k [2] http://groups.google.com/group/django-developers/msg/91f399820ee07ce5 -- Ivan

Re: py3k concerns. An example

2008-04-18 Thread Ivan Illarionov
ean. Even if Python code base will become fragmented why is it harmfull? This is a way our life work - you rise and get better or die. It is essential part of progress and evolution. IMHO, we'll only get better Python and better Python libraries. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: 2's complement conversion. Is this right?

2008-04-18 Thread Ivan Illarionov
{NULL, NULL, 0, NULL}, }; DL_EXPORT(void) init_from3bytes(void) { Py_InitModule("_from3bytes", functions); } buildme.py == import os import sys from distutils.core import Extension, setup os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.argv = [sys.argv[0], 

Re: 2's complement conversion. Is this right?

2008-04-18 Thread Ivan Illarionov
On Sat, 19 Apr 2008 04:45:54 +, Ivan Illarionov wrote: > On Fri, 18 Apr 2008 22:30:45 -0500, Grant Edwards wrote: > >> On 2008-04-18, Bob Greschke <[EMAIL PROTECTED]> wrote: >> >>> However, in playing around with your suggestion and Grant's code I

Re: 2's complement conversion. Is this right?

2008-04-21 Thread Ivan Illarionov
On 20 апр, 04:10, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 18, 9:36 pm, Ross Ridge <[EMAIL PROTECTED]> > wrote: > > > > > Ross Ridge <[EMAIL PROTECTED]> said: > > > > If you have Python 2.5, here's a faster version: > > > >from struct import * > > >unpack_i32be = Struct(">l").unpac

Re: 2's complement conversion. Is this right?

2008-04-21 Thread Ivan Illarionov
On 22 апр, 00:10, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On 20 ÁÐÒ, 04:10, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Apr 18, 9:36 pm, Ross Ridge <[EMAIL PROTECTED]> > > wrote: > > > > Ross Ridge <[EMAIL PROTECTED]> sai

Re: 2's complement conversion. Is this right?

2008-04-21 Thread Ivan Illarionov
On 22 апр, 01:01, Peter Otten <[EMAIL PROTECTED]> wrote: > Ivan Illarionov wrote: > > And even faster: > > a = array.array('i', '\0' + '\0'.join((s[i:i+3] for i in xrange(0, > > len(s), 3 > > if sys.byteorder == '

Re: 2's complement conversion. Is this right?

2008-04-21 Thread Ivan Illarionov
On Mon, 21 Apr 2008 16:10:05 -0700, George Sakkis wrote: > On Apr 21, 5:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > >> On 22 ÁÐÒ, 01:01, Peter Otten <[EMAIL PROTECTED]> wrote: >> >> > Ivan Illarionov wrote: >> > > And even faster: &g

Re: 2's complement conversion. Is this right?

2008-04-21 Thread Ivan Illarionov
On Mon, 21 Apr 2008 16:10:05 -0700, George Sakkis wrote: > On Apr 21, 5:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > >> On 22 ÁÐÒ, 01:01, Peter Otten <[EMAIL PROTECTED]> wrote: >> >> > Ivan Illarionov wrote: >> > > And even faster: &g

Re: Python Success stories

2008-04-22 Thread Ivan Illarionov
On 22 апр, 14:25, azrael <[EMAIL PROTECTED]> wrote: [] > This hurts. Please give me informations about realy famous > aplications. What do you mean by "really famous"? Information is here: http://www.python.org/about/quotes/ Are YouTube and Google famous en

Re: @classmethod question

2008-04-23 Thread Ivan Illarionov
nstances is not allowed" % type.__name__ return self.ingredients_manager Then, "at another time, wanting to know what all the ingredients would be to make cookies, cake and bread" you would call: RecipieClass.objects.get_ingrendients(['cookies','cake','bread']) Both Django and Google Apps Engine API use similar concepts and you can learn much more interesting looking in their source code. Regards, -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: list.reverse()

2008-04-29 Thread Ivan Illarionov
1, 0] >> >> > You can also use list slicing to get a reversed list: > >>>> x = range(5) >>>> x > [0, 1, 2, 3, 4] >>>> x[::-1] > [4, 3, 2, 1, 0] > > -- Paul More alternatives: >>> range(4, -1, -1) [4, 3, 2, 1, 0] >&g

Re: @classmethod question

2008-04-29 Thread Ivan Illarionov
thread are definetly more practical) and don't try to use classmethods, custom descriptors and metaclasses unless you *really* need this stuff. AFAIK all these metaprogramming tricks make sense only for frameworks and for learning Python, but make very little or no sense for smaller apps. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
http://en.wikipedia.org/wiki/YAML As for where to store it, I completely agree with Nick Craig-Wood. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Signals/Slots support in Python

2008-05-01 Thread Ivan Illarionov
subsequently integrated into this: > <http://djangoproject.com> AFAIK PyDispatcher evolved into Louie project [1]. Louie has more features, but dispatch module inside Django is dramatically faster and is going to be even faster. [1] http://pylouie.org/ -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 11:11:29 -0500, Jon Ribbens wrote: > On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> IMO .ini-like config files are from the stone age. The modern approach >> is to use YAML (http://www.yaml.org). > > You mean YAML isn

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 09:45:28 -0700, Carl Banks wrote: > On May 1, 12:11 pm, Jon Ribbens <[EMAIL PROTECTED]> wrote: >> On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> >> > IMO .ini-like config files are from the stone age. The modern >> >

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 14:13:08 -0500, Jon Ribbens wrote: > On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> I used XML files before for this purpose and found YAML much easier and >> better suitable for the task. >> >> Please explain why don't li

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 11:56:20 -0700, Carl Banks wrote: > On May 1, 1:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> On Thu, 01 May 2008 09:45:28 -0700, Carl Banks wrote: >> > On May 1, 12:11 pm, Jon Ribbens <[EMAIL PROTECTED]> wrote: >> >> On 200

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 23:03:38 +0200, Torsten Bronger wrote: > Hallöchen! > > Ivan Illarionov writes: > >> [...] >> >> I took the example from >> http://www.kuro5hin.org/story/2004/10/29/14225/062 I haven't use my own >> example only because I

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Thu, 01 May 2008 16:32:00 -0700, Carl Banks wrote: > On May 1, 4:50 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> On Thu, 01 May 2008 11:56:20 -0700, Carl Banks wrote: >> > On May 1, 1:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> >> On T

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Ivan Illarionov
On Fri, 02 May 2008 01:21:38 +0200, Torsten Bronger wrote: > Hallöchen! > > Ivan Illarionov writes: > >> [...] >> >> For me it looks more like an old-school/new-school thing than use-case >> thing. I may be wrong, but I see more and more new projects use thin

Re: How to use a parameter in a class

2008-05-03 Thread Ivan Illarionov
mmy(thisValue = 12) > > And that someFunction gets a default value of 12. How can I do that? class Dummy(object): def __init__(self, thisValue): self.value = thisValue def someFunction(self, default=None): if default is None: default = self.value -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Ivan Illarionov
rk with everything, not just floats. I think it would be useful addition to standard math module. If you know C you could write a patch to mathmodule.c and submit it to Python devs. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Ivan Illarionov
tried > > sum(['abc', 'efg'], '') Interesting, I always thought that sum is like shortcut of reduce(operator.add, ...), but I was mistaken. reduce() is more forgiving: reduce(operator.add, ['abc', 'efg'], '' ) # it works 'abcefg' -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL JPEG mis-step

2008-05-03 Thread Ivan Illarionov
On Sat, 03 May 2008 17:01:44 -0700, darkblueB wrote: > On May 3, 4:52 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> Try run 'python setup.py build_ext -f' to force setup.py to rebuild >> everything with JPEG. And 'sudo python setup.py install' should i

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Ivan Illarionov
On Sun, 04 May 2008 00:31:01 +0200, Thomas Dybdahl Ahle wrote: > On Sat, 2008-05-03 at 21:37 +0000, Ivan Illarionov wrote: >> On Sat, 03 May 2008 20:44:19 +0200, Szabolcs Horvát wrote: >> >> > Arnaud Delobelle wrote: >> >> >> >> sum() works fo

Re: PIL JPEG mis-step

2008-05-03 Thread Ivan Illarionov
TCL_ROOT = '/usr/lib/tcl8.4', '/usr/include/tcl8.4' And make sure that you have tcl/tk libraries/headers: sudo apt-get install tcl8.4-dev tk8.4-dev -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Ivan Illarionov
On Sat, 03 May 2008 17:43:57 -0700, George Sakkis wrote: > On May 3, 7:12 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: >> On Sun, 04 May 2008 00:31:01 +0200, Thomas Dybdahl Ahle wrote: >> > On Sat, 2008-05-03 at 21:37 +, Ivan Illarionov wrote: >> >>

Re: howto print binary number

2008-05-07 Thread Ivan Illarionov
; Thank you in advance, D Here it is: def bin(x, digits=0): oct2bin = ['000','001','010','011','100','101','110','111'] binstring = [oct2bin[int(n)] for n in oct(x)] return ''.join(binstring

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
arer: [[0] + e.strip().split(':')[2:] for e in open('/etc/passwd')] -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 23:46:33 +, Ivan Illarionov wrote: > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > >> Is there a way to do: >> x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >> x[0,2:6] >> >> That would return: >> [0, 3, 4, 5, 6] > > IM

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Wed, 07 May 2008 21:13:27 -0400, Miles wrote: > On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov > <[EMAIL PROTECTED]> wrote: > > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: > > > > > Is there a way to do: > > > x = [1, 2

Re: slicing lists

2008-05-07 Thread Ivan Illarionov
On Thu, 08 May 2008 01:15:43 +, Ivan Illarionov wrote: > On Wed, 07 May 2008 21:13:27 -0400, Miles wrote: > >> On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov >> <[EMAIL PROTECTED]> wrote: >> > On Wed, 07 May 2008 23:29:27 +, Yves Dorfsman wrote: &g

Re: How to modify meaning of builtin function "not" to "!"?

2008-05-09 Thread Ivan Voras
grbgooglefan wrote: > I am creating functions, the return result of which I am using to make > decisions in combined expressions. > In some expressions, I would like to inverse the return result of > function. > > E.g. function contains(source,search) will return true if "search" > string is found

Re: Now what!?

2008-05-10 Thread Ivan Illarionov
broken, possible causes: 1. Wrong line endings (should be \n) 2. Whitespace before the shebang -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: do you fail at FizzBuzz? simple prog test

2008-05-10 Thread Ivan Illarionov
; > elif i%5 == 0 and i%3 != 0: > print "Buzz" > elif i%5 == 0 and i%3 == 0: > print "FizzBuzz" > else: > print i > > > is there a better way than my solution? is mine ok? ['%s%s' % (not i%3 and 'Fizz' or '', not i%5 and 'Buzz' or '') or str(i) for i in xrange(1, 101)] -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: do you fail at FizzBuzz? simple prog test

2008-05-10 Thread Ivan Illarionov
On Sun, 11 May 2008 04:26:10 +, Ivan Illarionov wrote: > On Sat, 10 May 2008 18:12:37 -0700, globalrev wrote: > >> http://reddit.com/r/programming/info/18td4/comments >> >> claims people take a lot of time to write a simple program like this: >> >>

wxPython beginners problem

2008-08-15 Thread Ivan Reborin
=== restart === shows up. How can I keep the window to "stay alive" so I see what I get ? I'm on a winxp platform using python 2.5.2. if that matters. Please, any help, constructive advice and ideas are very much appreciated. Best regards Ivan Reborin -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython beginners problem

2008-08-15 Thread Ivan Reborin
On Fri, 15 Aug 2008 18:31:16 +0200, Ivan Reborin <[EMAIL PROTECTED]> wrote: >Hello all, > >I'm new to python, new as newbies get, so please, don't take wrongly >if this seems like a stupid or overly simple question. > >I'm going through examples in a book

Re: wxPython beginners problem

2008-08-16 Thread Ivan Reborin
On Fri, 15 Aug 2008 17:48:39 + (UTC), Brian Victor <[EMAIL PROTECTED]> wrote: >Ivan Reborin wrote: >> win.Show > >This line isn't doing anything. It needs to be: >win.Show() # note the parentheses Yes, that was the problem. I must've been tired while wr

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Ivan Illarionov
tually catches anything. > > Carl Banks '__slots__' is better: class A(object): __slots__ = set(["x"]) def __init__(self, x): self.y = x this will do the same, only faster >>> A(1) Traceback (most recent call last): File "", line 1, in File

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Ivan Illarionov
On 4 сент, 21:49, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Ivan Illarionov a écrit : > > > > > On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > >> You can write code to guard against this if you want: > > >> class A: > >&g

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-05 Thread Ivan Illarionov
On 5 сент, 19:23, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Ivan Illarionov schrieb: > > > > > On 4 сент, 21:49, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > >> Ivan Illarionov a écrit : > > >>> On 4 сент, 22:

gplt from scipy missing ?

2008-09-22 Thread Ivan Reborin
File "", line 1, in from scipy import gplt ImportError: cannot import name gplt Please, can you help me solve this ? How do I get gplt to work ? All advice appreciated. Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
s. Do you know, by any chance, where one could get gplt separately, or for example, get older versions of scipy ? I'm using python 5.2.2.. If I install scipy for python 2.3. for example (let's assume that one still has gplt in it) will it work ? Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
On Tue, 23 Sep 2008 13:44:41 +0200, Ivan Reborin <[EMAIL PROTECTED]> wrote: >On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina" ><[EMAIL PROTECTED]> wrote: > >> >>I think scipy does not bundle plotting packages anymore - you may use >

Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
23456.7, 1234.000 - always 8 decimals) ? Is something like this possible (built-in) in python ? Really grateful for all the help and time you can spare. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
3f %12.3f ... 3 times but that is just unpractical. Is there a way to just do something like this (not normal syntax, just my wishful thinking): print 3*'%12.3f' %a,b,c (meaning - use this format for the next 3 real numbers that come along) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
ntheses. Python programmers thank you if put >them improving readability a little). Yes, ok. I can agree with that - separating the format from the variable list part sounds reasonable. > >Bye, >bearophile -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-30 Thread Ivan Reborin
s or something, which would allow one to load an array in a more natural "technical" way ? Like something mentioned above in my post (now deleted) ? Also, is there a way to change counter for arrays to go from 0 to 1 ? (first element being with the index 1) ? (probably not since that seems like a language implementation thing, but it doesn't hurt to ask) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-30 Thread Ivan Reborin
ran84, and mean to continue doing so as long as something better doesn't come along. But as I said, got a job that't got to be done, so I'm trying to figure out how to do array operations as easily as possible in python, which are necessary for all my calculations. Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list

Dynamically growing numarray array.

2006-03-22 Thread Ivan Vinogradov
Hello All, this seems like a trivial problem, but I just can't find an elegant solution neither by myself, nor with google's help. I'd like to be able to keep an array representing coordinates for a system of points. Since I'd like to operate on each point's coordinates individually, for sp

Re: What is Caching my DB

2006-03-27 Thread Ivan Voras
Siah wrote: > I just launched my django site for a client. My problem is something > is caching my db data in a bizzar way. Here are some of the behaviours > I get: > > - I login, and every other page it makes me login again for a 5 minutes > or so and then it remembers that I am logged in. > -

Re: How to search HUGE XML with DOM?

2006-03-31 Thread Ivan Vinogradov
like a selfish question, perhaps consider it a full disclosure, different set-ups/examples would be appreciated as well. -- Cheers, Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 licensing: stop this change

2006-04-01 Thread Ivan Herman
I would certainly look at *all details* of the announcement, including the second line from the top which gives the date:-) Ivan Caleb Hattingh wrote: > WAIT- > > Did I just get caught by an April Fools Joke? > > I have a nasty feeling about this :)) > > C > --

Calling Web Services from Python

2006-04-07 Thread Ivan Zuzak
s that are compatible with SOAP & WSDL standards? Thank you, ivan zuzak [1] - http://pywebsvcs.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to print without blank?

2006-04-08 Thread Ivan Herman
may want to use the write command with stdout: sys.stdout.write("%s" % x) using 'write' you have much more facilities to format the output... I hope this helps Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Web Services from Python

2006-04-11 Thread Ivan Zuzak
m.banaouas wrote: > Can you tell us more about SOAPpy bug ? > Is it about authentication ? > > Ivan Zuzak a écrit : > >> ... >> I need a package/tool that generates web service proxies that will do >> all the low-level HTTP work. (Someting like the WSDL.EXE to

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread Ivan Illarionov
, unsafe, unpythonic and plain evil: >>> import ctypes >>> ctypes.pythonapi.PyList_New.restype = ctypes.py_object >>> ctypes.pythonapi.PyList_New(100) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Imitating "tail -f"

2009-11-21 Thread Ivan Voras
I'm trying to simply imitate what "tail -f" does, i.e. read a file, wait until it's appended to and process the new data, but apparently I'm missing something. The code is: 54 f = file(filename, "r", 1) 55 f.seek(-1000, os.SEEK_END) 56 ff = fcntl.fcntl(f.fileno(), fcntl.F_GETFL) 5

Re: Quoting quotes

2010-02-26 Thread Ivan Šipoš
On 26.2.2010. 13:29, candide wrote: Suppose you have to put into a Python string the following sentence : The play "All's Well That Ends Well" by Shakespeare It's easy do it : print """The play "All's Well That Ends Well" by Shakespeare""" The play "All's Well That Ends Well" b

Resolving Weekday Schedules to Dates

2022-07-21 Thread Ivan "Rambius" Ivanov
Hello, Do you know of a library that resolves schedules like every Wednesday at 3:00pm to absolute time, that is return the datetime of the next occurrence? Regards rambius P.S. -- Tangra Mega Rock: http://www.radiotangra.com -- https://mail.python.org/mailman/listinfo/python-list

Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
Hello, I am developing a script that accepts a time zone as an option. The time zone can be any from pytz.all_timezones. I have def main(): parser = argparse.ArgumentParser() parser.add_argument("-z", "--zone", choices=pytz.all_timezones) args = parser.parse_args() print(args)

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
> print(“Invalid timezone”,file=sys.stderr) > This is what I use now. I still wonder if I can mold HelpFormatter to do what I want it to do. > … > > > > > From: Python-list on > behalf of Ivan "Rambius" Ivanov > Date: Frida

<    1   2   3   4   5   6   >