Re: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.304, 2.305
On Wed, Dec 17, 2003 at 12:43:35PM -0800, rhettinger@users.sourceforge.net wrote:
Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod.
Would sort() be a better name? When I told someone who's done quite a bit of java recently about sorted, he asked if it returned a bool whether the list was sorted or not. :-) Neal
[Raymond]
Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod.
[Neal]
Would sort() be a better name? When I told someone who's done quite a bit of java recently about sorted, he asked if it returned a bool whether the list was sorted or not. :-)
I think sorted() is better: * the context makes it clear that it's not a predicate * the name helps distinguish it from list.sort() * it fits with reversed() * looking at actual code using sorted(), it reads well my two cents, Raymond Hettinger
On Wednesday 17 December 2003 04:19 pm, Raymond Hettinger wrote:
I think sorted() is better:
* the context makes it clear that it's not a predicate * the name helps distinguish it from list.sort() * it fits with reversed() * looking at actual code using sorted(), it reads well
sorted() returns a list, and reversed() returns an iterator. That seems like a recipe for confusion, *especially* because they "fit" together and do completely different things. Jeremy
Neal Norwitz
On Wed, Dec 17, 2003 at 12:43:35PM -0800, rhettinger@users.sourceforge.net wrote:
Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod.
Would sort() be a better name?
No (<wink>).
When I told someone who's done quite a bit of java recently about sorted, he asked if it returned a bool whether the list was sorted or not. :-)
In Python, that would be issorted (please ignore callable <wink>). I'd expect sort() to mutate its argument. Cheers, mwh -- "The future" has arrived but they forgot to update the docs. -- R. David Murray, 9 May 2000
participants (4)
-
Jeremy Fincher
-
Michael Hudson
-
Neal Norwitz
-
Raymond Hettinger