Re: zlib.decompress cannot, gunzip can

2005-02-28 Thread Dima Dorfman
On 2005-03-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a string which I try to decompress: > > body = zlib.decompress(body) > > but I get > > zlib.error: Error -3 while decompressing data: incorrect header check > > However, I can write the string to a file and run gunzip with the

Re: My C module crashes

2005-02-28 Thread Dima Dorfman
On 2005-02-28, Egil Moeller <[EMAIL PROTECTED]> wrote: > I've written a C-module for Python, and it works as intended, but > obviously does something wrong with its memmory management (refference > counting), as it causes Python to segfault now and then (randomly, > whey :S) Have you tried compili

Re: Why do descriptors (and thus properties) only work on attributes.

2005-02-28 Thread Dima Dorfman
On 2005-02-28, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Op 2005-02-28, Diez B. Roggisch schreef <[EMAIL PROTECTED]>: >> I still don't see how that is supposed to work for "a lot of interesting >> things". Can you provide examples for one of these interesting things? > > Lazy evaluation where the

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Dima Dorfman
On 2005-02-18, Andy Dustman <[EMAIL PROTECTED]> wrote: > The reason it does this is exactly why you said: It iterates over the > sequence and gets the sum of the lengths, adds the length of n-1 > separators, and then allocates a string this size. Then it iterates > over the list again to build up t

Re: Memory Allocation?

2005-02-07 Thread Dima Dorfman
On 2005-02-07, Chris S. <[EMAIL PROTECTED]> wrote: > Is it possible to determine how much memory is allocated by an arbitrary > Python object? The hardest part about answering this question is figuring out what you want to count as being allocated for a particular object. That varies widely depen

Re: Improving Python (was: Lambda going out of fashion)

2004-12-26 Thread Dima Dorfman
On 2004-12-26, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > string methods are nice, but nothing groundbreaking, and their niceness is > almost entirely offset by the horrid "".join(seq) construct that keeps popping > up when people take the "the string module is deprecated" yada yada too > seriously

Re: better lambda support in the future?

2004-12-18 Thread Dima Dorfman
On 2004-12-18, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Dima Dorfman" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Both languages compile all three functions (f and the two versions of >> g) once and choose which g to return at r

Re: better lambda support in the future?

2004-12-17 Thread Dima Dorfman
On 2004-12-18, Jeff Shannon <[EMAIL PROTECTED]> wrote: > Would OCaml (or some > other static language) have something that's equivalent to this? > > def f(x): > if x < 0: > def g(y): > return y * -1 > else: > def g(y): > return y > return g > > f