[Python-Dev] Re: copysort patch, was RE: inline sort option

Terry Reedy tjreedy at udel.edu
Tue Oct 28 12:16:47 EST 2003


"Guido van Rossum" <guido at python.org> wrote in message
news:200310281518.h9SFIj129025 at 12-236-54-216.client.attbi.com...
> > 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.

After thinking about it some more, I also  prefer .sorted to suggested
alternatives.  I read it as follows:
  list(iterable) means 'make a list from iterable (preserving item
order)'
  list.sorted(iterable) means 'make a sorted list from iterable'
While I generally like verbs for method names, the adjective form
works here as modifing the noun/verb 'list' and the invoked
construction process.

'Inline' strikes me as confusing.  'Copy' and 'new' strike me as
redundant noise since, in the new 2.2+ regime,  'list' as a typal verb
*means* 'make a new list'.

Terry J. Reedy


Terry J. Reedy






More information about the Python-Dev mailing list