Re: My other pet python peeve - .sort(),.reverse(), etc. return None
Jack Jansen (Jack.Jansen@cwi.nl)
Tue, 14 Sep 1993 10:32:48 +0200
Recently, "Steven D. Majewski" <email@example.com> said:
> ( And I can't even think of some likely + reasonable code that would
> be broken by the change. I can't think that anyone ever *tests*
> that "list.sort() == None" - since that is, in fact, the only
> possible return value. )
Well, if all my programs that use list.sort() suddenly start spouting
output all over the place, I would consider that "broken".
It wouldn't be the kind of thing that is difficult to find, though,
especially with the new -k flag.
There's another thing I don't like about this, though, and that is the
fact that you either have to make sort() only return the sorted list
(i.e. leave the original intact), or both return it and update it
in-place. The first option *does* have backward-compatability problems
(and is less efficient to boot, since the current sort only moves some
pointers around), and the second one is not very elegant.
Jack Jansen | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution -- Emma Goldman