[Tutor] short circuiting

2009-06-25 Thread Dave C
Hi I've read that the builtin all() function stops evaluating as soon as it hits a false item, meaning that items after the first false one are not evaluated. I was wondering if someone could give an example of where all()'s short circuiting is of consequence, akin to: False and produces_side_eff

[Tutor] why PyObject_VAR_HEAD?

2009-06-25 Thread Eric Zhao
Hi, I'm studying the CPython source code. I don't quite understand why they're using PyObject_VAR_HEAD to define struct like PyListObject. To define such kind of struct, could I use _PyObject_HEAD_EXTRA as a header and add "items" pointer and "allocated" count explicity? Is there any difference

Re: [Tutor] Program Slicing / Trace

2009-06-25 Thread Kent Johnson
On Thu, Jun 18, 2009 at 10:37 AM, Jojo Mwebaze wrote: > Hi Tutor > > The problem i have is to see which statements modify my data at execution > time without referring to the code. Referring to the code is difficult esp > because of branching. You can never tell before hand which branch execution >

Re: [Tutor] re module / separator

2009-06-25 Thread Tiago Saboga
Thanks Kent! Once more you go straight to the point! Kent Johnson writes: > On Wed, Jun 24, 2009 at 2:24 PM, Tiago Saboga wrote: >> In [33]: re.search("(a[^.]*?b\.\s?){2}", text).group(0) >> Out[33]: 'a45453b. a325643b. ' > > group(0) is the entire match so this returns what you expect. But what

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread Richard Lovely
2009/6/25 Lie Ryan : > > Although pickle output only ascii string, it is not meant to be human > readable at all. Basically there is no difference how it is stored as > long as what goes in is equal with what goes out. I can't think of a > need to sort or compare raw pickle data. > > __

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread Dinesh B Vadhia
Alan On a machine with 6gb of ram, storing very long strings in sqlite caused a "sqlite3.OperationalError: Could not decode to UTF-8 column 'j' with text" which has been resolved. This fix then caused a memory error when reading some of the strings back from the db. Hence, I'm trying to work

[Tutor] syntax error

2009-06-25 Thread Christopher Altieri
loaded python 3 and 3.1 several times on vista. tried first command: print "hello world' but keep getting syntax error. what am I doing wrong? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] syntax error

2009-06-25 Thread Christian Witts
Christopher Altieri wrote: loaded python 3 and 3.1 several times on vista. tried first command: print "hello world' but keep getting syntax error. what am I doing wrong? ___ Tu

Re: [Tutor] short circuiting

2009-06-25 Thread Kent Johnson
On Wed, Jun 24, 2009 at 11:32 PM, Dave C wrote: > Hi > I've read that the builtin all() function stops evaluating as soon as > it hits a false item, meaning that items after the first false one are > not evaluated. > > I was wondering if someone could give an example of where all()'s > short circui

Re: [Tutor] string pickling and sqlite blob'ing

2009-06-25 Thread vince spicer
Dinesh In theory you can store in either type(i have done it), however you should store in the binary column, blob Vince On Wed, Jun 24, 2009 at 2:42 PM, Dinesh B Vadhia wrote: > Hi Vince > > That's terrific! Once a string is compressed with gzip.zlib does it make a > difference whether it

Re: [Tutor] Fwd: Problems with parameter queries

2009-06-25 Thread Eduardo Vieira
On Wed, Jun 24, 2009 at 6:16 PM, Richard Lovely wrote: > (oops... forgot to reply-all) > > > -- Forwarded message -- > From: Richard Lovely > Date: 2009/6/25 > Subject: Re: [Tutor] Problems with parameter queries > To: Eduardo Vieira > > > 2009/6/24 Eduardo Vieira : >> Hello, I am

Re: [Tutor] short circuiting

2009-06-25 Thread bob gailer
Kent Johnson wrote: On Wed, Jun 24, 2009 at 11:32 PM, Dave C wrote: Hi I've read that the builtin all() function stops evaluating as soon as it hits a false item, meaning that items after the first false one are not evaluated. I was wondering if someone could give an example of where all()'s