copysort patch, was RE: [Python-Dev] inline sort option
tanzer at swing.co.at
Tue Oct 28 12:23:29 EST 2003
Alex Martelli <aleaxit at yahoo.com> wrote:
> On Tuesday 28 October 2003 04:18 pm, Guido van Rossum wrote:
> > > Okay, this is the last chance to come-up with a name other than
> > > sorted().
> > >
> > > Here are some alternatives:
> > >
> > > inlinesort() # immediately clear how it is different from sort()
> > > sortedcopy() # clear that it makes a copy and does a sort
> > > newsorted() # appropriate for a class method constructor
> > >
> > >
> > > I especially like the last one and all of them provide a distinction
> > > from list.sort().
> > While we're voting, I still like list.sorted() best, so please keep
> > that one in the list of possibilities.
> I also like list.sorted() -- but list.newsorted() is IMHO even a LITTLE
> bit better, making it even clearer that it's giving a NEW list. Just
> a _little_ preference, mind you. "sortedcopy" appears to me a BIT
> less clear (what "copy", if the arg isn't a list...?), "inlinesort" worst.
IMO, sorted is the clearest, all other proposals carry excess baggage
making them less clear.
> Perhaps this points to an issue with classmethods in
> general, due in part to the fact that they're still rather
> little used in Python -- callers of instance.method()
> may mostly expect that the result has something to
> do with the instance's value, rather than being the
> same as type(instance).method() -- little we can do
> about it at this point except instruction, I think.
Or put the method into the metaclass. I'm using both classmethods and
methods defined by metaclasses and didn't get any complaints about
Christian Tanzer http://www.c-tanzer.at/
More information about the Python-Dev