no more comparisons

Paul Rubin http
Wed Mar 12 18:38:32 EDT 2008


Carl Banks <pavlovevidence at gmail.com> writes:
> > For example:http://www.python.org/dev/peps/pep-3100/
> >         list.sort() and builtin.sorted() methods: eliminate cmp parameter [27] [done]
> 
> Hmm, wasn't aware they were taking it that far.  You should almost
> always avoid using the cmp parameter because it's very inefficient;

I don't see what's so inefficient about it necessarily.  The key
argument invokes a DSU scheme that allocates and releases potentially
a lot of memory, which both uses time and increases the program's
memory region.  The cmp option should not be removed.  However,
requiring it to be specified as a keyword parameter instead of
just passed as an unlabelled arg is fine.



More information about the Python-list mailing list