[Python-Dev] Python3 regret about deleting list.sort(cmp=...) (original) (raw)
Reid Kleckner reid.kleckner at gmail.com
Sat Mar 12 23:09:29 CET 2011
- Previous message: [Python-Dev] Python3 regret about deleting list.sort(cmp=...)
- Next message: [Python-Dev] Python3 regret about deleting list.sort(cmp=...)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Mar 12, 2011 at 4:58 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
On Sat, Mar 12, 2011 at 4:50 PM, Reid Kleckner <reid.kleckner at gmail.com> wrote:
They should be able to use a slotted cmptokey style class: http://docs.python.org/howto/sorting.html
That will allocate 1 Python object with no dict per key, but that might not be good enough. Tuples are already slotted, so that isn't likely to help in this case.
It's three allocations vs. one. The first is tuple + str + int, while the adapter is just one object. I'm not sure how it eventually shakes out, though.
That said, it's still worse than Python 2, which is zero allocations. :)
Reid
- Previous message: [Python-Dev] Python3 regret about deleting list.sort(cmp=...)
- Next message: [Python-Dev] Python3 regret about deleting list.sort(cmp=...)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]