Sorting out sort (Re: Python vs. Ruby)

Andrew Bennetts andrew-pythonlist at puzzling.org
Fri Jan 3 15:48:28 CET 2003


On Fri, Jan 03, 2003 at 09:29:54AM -0500, John Roth wrote:
> 
> "Anders J. Munch" <andersjm at dancontrol.dk> wrote in message
> news:3e144c3a$0$71645$edfadb0f at dread11.news.tele.dk...
> >
> > def reverse(sequence):
> >     """reverse a sequence, returning a new list"""
> >     reversed = list(sequence)
> >     reversed.reverse()
> >     return reversed
> >
> > print reverse(sort([1,4,2,3]))
> >
> > What more do you need?
> 
> Something that chains properly.

Really?  How often would you want to call
l.sort().sort().reverse().reverse()?  ;)

-Andrew.






More information about the Python-list mailing list