Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread M.-A. Lemburg
On 2008-02-13 08:02, Andrew MacIntyre wrote: Christian Heimes wrote: Andrew MacIntyre wrote: I tried a LIFO stack implementation (though I won't claim to have done it well), and found it slightly slower than no freelist at all. The advantage of such an approach is that the known size of the

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Andrew MacIntyre
Christian Heimes wrote: Andrew MacIntyre wrote: I tested the updated patch you added to issue 2039. With the int freelist set to 500 and the float freelist set to 100, its about the same as the no-freelist version for my tests, but PyBench shows the simple float arithmetic to be about 10%

[Python-Dev] Why is there to Lib/test/test_int.py?

2008-02-13 Thread Eric Smith
I want to add test cases for int.__format__(), and I went looking for Lib/test/test_int.py. I've added tests into Lib/test/test_long.py, so I assumed there was an int version, but no. Is there any particular reason for that, and are there int tests elsewhere? If not, I'll add test_int.py,

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread M.-A. Lemburg
On 2008-02-13 12:56, Andrew MacIntyre wrote: I'm not that interested in debating the detail of exactly how big the prospective LIFO freelists are - I just want to see the situation resolved with maximum utilisation of memory for minimum performance penalty. To that end, +1 from me for

[Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
When backporting PEP 3101, do we want to add __format__ to classic classes? If so, could someone give me a pointer on how to implement this? I don't see where to hook it up. Thanks. Eric. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Mutable sequence .sort() signature

2008-02-13 Thread A.M. Kuchling
On Tue, Feb 12, 2008 at 08:19:27PM -0800, Guido van Rossum wrote: [on the 'What's New in 3.0' document] I think that's a good start. Andrew Kuchling can always move it later if that section becomes too crowded or uneven. I won't be able to work on the 3.0 document in time for 3.0 final

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Andrew MacIntyre
M.-A. Lemburg wrote: On 2008-02-13 12:56, Andrew MacIntyre wrote: I'm not that interested in debating the detail of exactly how big the prospective LIFO freelists are - I just want to see the situation resolved with maximum utilisation of memory for minimum performance penalty. To that end,

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Christian Heimes
M.-A. Lemburg wrote: +1 on removing the freelists from ints and floats, but not the small int sharing optimization +1 on focusing on improving pymalloc to handle int and float object allocations even better -1 on changing the freelist implementations to use pymalloc for

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 5:28 AM, Eric Smith [EMAIL PROTECTED] wrote: When backporting PEP 3101, do we want to add __format__ to classic classes? If so, could someone give me a pointer on how to implement this? I don't see where to hook it up. You just have to get the '__format__' attribute and call

Re: [Python-Dev] Why is there to Lib/test/test_int.py?

2008-02-13 Thread Guido van Rossum
I think most int tests are probably in test_types.py. If you were to create test_int.py now it would probably interfere with the renaming of test_long.py to test_int.py in the py3k branch (eventually). On Feb 13, 2008 4:12 AM, Eric Smith [EMAIL PROTECTED] wrote: I want to add test cases for

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
Guido van Rossum wrote: On Feb 13, 2008 5:28 AM, Eric Smith [EMAIL PROTECTED] wrote: When backporting PEP 3101, do we want to add __format__ to classic classes? If so, could someone give me a pointer on how to implement this? I don't see where to hook it up. You just have to get the

[Python-Dev] Small configure typo?

2008-02-13 Thread Jeroen Ruigrok van der Werven
With zsh when I try to autocomplete the ./configure options I get this: _arguments:comparguments:303: invalid option definition: --enable-universalsdk[SDKDIR][Build against Mac OS X 10.4u SDK (ppc/i386)] Should this be: --enable-universalsdk[=SDKDIR] ? (Note the = ) -- Jeroen Ruigrok van der

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 9:48 AM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 5:28 AM, Eric Smith [EMAIL PROTECTED] wrote: When backporting PEP 3101, do we want to add __format__ to classic classes? If so, could someone give me a pointer on how to implement this?

Re: [Python-Dev] __new__ deprecation

2008-02-13 Thread Guido van Rossum
What __new__ deprecation warning? On Feb 13, 2008 11:50 AM, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: People, where can I find rationale/background on the __new__ deprecation warning in 2.6 (and I assume it's totally different in 3.0)? I could not find anything about it in

[Python-Dev] 2.5.2 freeze upcoming

2008-02-13 Thread Martin v. Löwis
The 2.5 maintenance branch will be frozen tomorrow (Thursday) around 7:00 UTC. Please don't make any changes to the branch after that point unless you are directly involved in the release process. If there are any issues that you think should be considered before the 2.5.2 release, please assign

Re: [Python-Dev] Mutable sequence .sort() signature

2008-02-13 Thread Daniel Stutzbach
On Feb 12, 2008 8:39 PM, Kurt B. Kaiser [EMAIL PROTECTED] wrote: I'd say in PEP3100. Here's a patch: http://bugs.python.org/issue2092 The suggested patch does not actually point to any discussion or rationale for why this change was made; it just contains a pointer to this thread (which is

Re: [Python-Dev] Small configure typo?

2008-02-13 Thread Brett Cannon
On Feb 13, 2008 9:24 AM, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: With zsh when I try to autocomplete the ./configure options I get this: _arguments:comparguments:303: invalid option definition: --enable-universalsdk[SDKDIR][Build against Mac OS X 10.4u SDK (ppc/i386)] Should

[Python-Dev] __new__ deprecation

2008-02-13 Thread Jeroen Ruigrok van der Werven
People, where can I find rationale/background on the __new__ deprecation warning in 2.6 (and I assume it's totally different in 3.0)? I could not find anything about it in http://docs.python.org/dev/3.0/whatsnew/3.0.html or http://docs.python.org/dev/whatsnew/2.6.html Cheers, -- Jeroen

[Python-Dev] Py3k and asyncore/asynchat

2008-02-13 Thread Daniel Arbuckle
A while back, I volunteered to update asyncore and asynchat for py3k. I posted a patch, and in response to feedback posted a more complicated patch+modification. Both versions have been languishing at http://bugs.python.org/issue1563 for a couple of months now without any further feedback or

Re: [Python-Dev] Mutable sequence .sort() signature

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 12:09 PM, Daniel Stutzbach [EMAIL PROTECTED] wrote: Without the cmp argument, what's the concise way to spell something like sort a list of floats by absolute value? It'd be nice to have a stock example to help users rewrite their code to work with 3.0. L.sort(key=abs) --

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
Guido van Rossum wrote: On Feb 13, 2008 9:48 AM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 5:28 AM, Eric Smith [EMAIL PROTECTED] wrote: When backporting PEP 3101, do we want to add __format__ to classic classes? If so, could someone give me a pointer on how

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 12:07 PM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 9:48 AM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 5:28 AM, Eric Smith [EMAIL PROTECTED] wrote: When backporting PEP 3101, do we want to add __format__

Re: [Python-Dev] __new__ deprecation

2008-02-13 Thread Jeroen Ruigrok van der Werven
-On [20080213 21:02], Guido van Rossum ([EMAIL PROTECTED]) wrote: What __new__ deprecation warning? Yes, sorry, I realized after sending that it might be a bit obtuse. With 2.6: DeprecationWarning: object.__new__() takes no parameters return object.__new__(cls, uri) -- Jeroen Ruigrok van

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
Guido van Rossum wrote: Much to my surprise, this already works: format(oldstyle(), '+^50s') '+__main__.oldstyle instance at 0x3d91f8+' So I guess it's a moot point. I'm using the same code as I use in 3.0, where I call: meth = _PyType_Lookup(Py_TYPE(value), format_str);

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
Nick Coghlan wrote: Eric Smith wrote: I hate to be dense, but could you point me to some code that does something similar but looks up the method by name? I was going to suggest __enter__/__exit__, but that code relies mainly on existing opcodes and just does an attribute lookup rather

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Nick Coghlan
Eric Smith wrote: I hate to be dense, but could you point me to some code that does something similar but looks up the method by name? I was going to suggest __enter__/__exit__, but that code relies mainly on existing opcodes and just does an attribute lookup rather than explicitly bypassing

Re: [Python-Dev] __new__ deprecation

2008-02-13 Thread Guido van Rossum
a symptom of a bug in your program. --Guido On Feb 13, 2008 12:19 PM, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: -On [20080213 21:02], Guido van Rossum ([EMAIL PROTECTED]) wrote: What __new__ deprecation warning? Yes, sorry, I realized after sending that it might be a bit obtuse

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 2:20 PM, Eric Smith [EMAIL PROTECTED] wrote: Nick Coghlan wrote: Eric Smith wrote: I hate to be dense, but could you point me to some code that does something similar but looks up the method by name? I was going to suggest __enter__/__exit__, but that code relies mainly

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
Guido van Rossum wrote: On Feb 13, 2008 2:20 PM, Eric Smith [EMAIL PROTECTED] wrote: Nick Coghlan wrote: Eric Smith wrote: I hate to be dense, but could you point me to some code that does something similar but looks up the method by name? I was going to suggest __enter__/__exit__, but that

[Python-Dev] Error in post-revprop-change hook in svn

2008-02-13 Thread Brett Cannon
I mistyped Jeroen's name so I edited the log message. But I got the following error message in the process:: svn: 'post-revprop-change' hook failed; no error output available The change still occurred, though. Anybody with access to the svn hooks know what is going on? -Brett

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
On Feb 13, 2008 2:57 PM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 2:20 PM, Eric Smith [EMAIL PROTECTED] wrote: Nick Coghlan wrote: Eric Smith wrote: I hate to be dense, but could you point me to some code that does something similar but looks up the

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Greg Ewing
Christian Heimes wrote: By the way objects are always aligned at 8 byte address boundaries. A 12 or 4 bytes object occupies 16 bytes. Maybe pymalloc should be enhanced so it can cope with certain odd-sized objects, such as 12 bytes? -- Greg ___

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Eric Smith
[slight mailer problem, this might show up as a dupe. sorry] Guido van Rossum wrote: On Feb 13, 2008 2:57 PM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: On Feb 13, 2008 2:20 PM, Eric Smith [EMAIL PROTECTED] wrote: Nick Coghlan wrote: However, the source code for cPickle may

Re: [Python-Dev] Py3k and asyncore/asynchat

2008-02-13 Thread Bill Janssen
It's a big patch, but I'll try applying it to the current py3k branch -- does it apply? -- and try a few things with it. I'm concerned about how well it behaves with things like Medusa (which probably needs its own py3k update). Bill ___ Python-Dev

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Andrew MacIntyre
Christian Heimes wrote: By the way objects are always aligned at 8 byte address boundaries. A 12 or 4 bytes object occupies 16 bytes. No, with PyMalloc a 4 byte object occupies 8 bytes (see the comments at the top of Objects/obmalloc.c). Cheers, Andrew. --

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Jeffrey Yasskin
On Feb 13, 2008 1:42 PM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: Much to my surprise, this already works: format(oldstyle(), '+^50s') '+__main__.oldstyle instance at 0x3d91f8+' So I guess it's a moot point. I'm using the same code as I use in 3.0,

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Jeffrey Yasskin
Oops, sorry for the spam. I didn't see that there were already answers in the rest of the thread. :-( On Feb 13, 2008 9:25 PM, Jeffrey Yasskin [EMAIL PROTECTED] wrote: On Feb 13, 2008 1:42 PM, Eric Smith [EMAIL PROTECTED] wrote: Guido van Rossum wrote: Much to my surprise, this already

Re: [Python-Dev] Py3k and asyncore/asynchat

2008-02-13 Thread Daniel Arbuckle
They applied when posted them, but subsequent patches seem to have broken them. I've now posted updated patches that apply cleanly against revision 60780. On Feb 13, 2008 6:52 PM, Bill Janssen [EMAIL PROTECTED] wrote: It's a big patch, but I'll try applying it to the current py3k branch -- does

Re: [Python-Dev] Error in post-revprop-change hook in svn

2008-02-13 Thread Martin v. Löwis
I mistyped Jeroen's name so I edited the log message. But I got the following error message in the process:: svn: 'post-revprop-change' hook failed; no error output available The change still occurred, though. Anybody with access to the svn hooks know what is going on? I have no clue.

Re: [Python-Dev] Adding __format__ to classic classes

2008-02-13 Thread Guido van Rossum
Try this: if (PyInstance_Check(obj)) { bound_method = PyObject_GetAttr(obj, str__format__); if (!bound_method) return NULL; call it passing only the format string Py_DECREF(bound_method); return whatever the call returned } else { do it the py3k way; } On Feb 13, 2008 5:31 PM,

Re: [Python-Dev] int/float freelists vs pymalloc

2008-02-13 Thread Christian Heimes
Andrew MacIntyre wrote: By the way objects are always aligned at 8 byte address boundaries. A 12 or 4 bytes object occupies 16 bytes. No, with PyMalloc a 4 byte object occupies 8 bytes (see the comments at the top of Objects/obmalloc.c). I know. It's a typo. It should read 12 or 14 byte