[Python-Dev] decorate-sort-undecorate

Tim Peters tim.one at comcast.net
Tue Oct 14 16:45:44 EDT 2003


[Raymond]
>> I would rather wrap Tim's existing code than muck with assignment
>> logic. Ideally, the performance of list.sort() should stay unchanged
>> when the key function is not specified.

[Guido]
> Impossible -- the aux objects tax the memory cache more.  Also the
> characteristics of the data will be very different.

I think Raymond has in mind that if a key argument isn't specified, then aux
objects aren't needed, and wouldn't be constructed -- the list would get
sorted the same way it does now.

>> ...
>> Alternatively, is there a way of telling a PyInt to be mortal?

There isn't, but we shouldn't let that drive anything.  I don't think any
law requires that Python always have an unbounded freelist for int objects.
Most objects with custom freelists put a bound on the freelist size (as
Guido noted in this thread for small tuples).  I'm not sure why ints don't;
I guess nobody ever felt motivated enough to stick a bound on 'em.




More information about the Python-Dev mailing list