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/039132.html below:

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

copysort patch, was RE: [Python-Dev] inline sort optionMark Russell marktrussell at btopenworld.com
Tue Oct 21 07:18:16 EDT 2003
On Tue, 2003-10-21 at 12:00, Alex Martelli wrote:
> Why should multiple data types acquire separate .sort methods with
> subtly different semantics (one works in-place and returns None, one
> doesn't mutate the object and returns a list, ...) when there's no real
> added value wrt ONE classmethod of list...?

I agree that the different semantics for lists and dicts are a strike
against this.  The argument for it is that walking over a dictionary in
sorted order is (at least to me) a missing idiom in python.  Does this
never come up when you're teaching the language?

I wouldn't advocate adding this to other types (e.g. Set) because
they're much less commonly used than dicts, so I don't think there's a
danger of a creeping plague of sort methods.  Not a big deal though -
list.sorted() is the real win.

Mark Russell

PS: I'm really not an anal-retentive keystoke counter :-)

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