[Python-Dev] Python3 regret about deleting list.sort(cmp=...) (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sat Mar 12 23:45:43 CET 2011


On Sat, Mar 12, 2011 at 5:41 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:

Why not? IIUC, the current key function creates three objects: the tuple, the short string, and the int. With the class

Yeah, I misread the example. Using cmp_to_key would indeed save quite a lot of memory in this case.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list