A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039305.html below:

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

copysort patch, was RE: [Python-Dev] inline sort optionRaymond Hettinger python at rcn.com
Wed Oct 22 14:30:53 EDT 2003
Did the discussion of a sort() expression get resolved?

The last I remember was that the list.sorted() classmethod had won the
most support because it accepted the broadest range of inputs.

I could live with that though I still prefer the more limited
(list-only) copysort() method.



Raymond Hettinger


> Let's see what the use cases look like under the various proposals:
> 
>   todo = [t for t in tasks.copysort() if due_today(t)]
>   todo = [t for t in list.sorted(tasks) if due_today(t)]
>   todo = [t for t in list(tasks, sorted=True) if due_today(t)]
> 
>   genhistory(date, events.copysort(key=incidenttime))
>   genhistory(date, list.sorted(events, key=incidenttime))
>   genhistory(date, list(events, sorted=True, key=incidenttime))
> 
>   for f in os.listdir().copysort(): . . .
>   for f in list.sorted(os.listdir()): . . .
>   for f in list(os.listdir(), sorted=True): . . .
> 
> To my eye, the first form reads much better in every case.
> It still needs a better name though.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4