list.sort, was Re: [Python-Dev] decorate-sort-undecorate

Kevin J. Butler python-kbutler at sabaydi.com
Wed Oct 15 17:05:34 EDT 2003


From: Barry Warsaw <barry at python.org>
> While we're hacking on [].sort(), how horrible would it be if we
> modified it to return self instead of None?

BDFL:
> -1000.  This is non-negotiable.

[Barry's blissful demo code snipped]

+1

Just 998 votes to go - nice to have a precise value on BDFL 
pronouncements.  No voting twice with bigger numbers! ;-)

I think just about everyone gets tripped up by the "sort returns None" 
behavior, and though one (e.g., BDFL) can declare that it is a less 
significant stumble than not realizing the list is sorted in place, it 
is a _continuing_ inconvenience, with virtually every call to [].sort, 
even for Python experts (like Barry, not me).

Small-ongoing-issue-trumps-one-time-surprise-ly y'rs,

kb

PS.  Just realized I made a similar post over 6 years ago. 
http://www.google.com/groups?selm=w4niv00k9sc.fsf%40jamaica.cs.byu.edu 
Does that mean I should just give it up already, or does it emphasize 
that it is an ongoing issue?  Though I still like the fact that the 
change would not break /any/ existing code...




More information about the Python-Dev mailing list