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

[Python-Dev] decorate-sort-undecorate

[Python-Dev] decorate-sort-undecorate [Python-Dev] decorate-sort-undecorateMoore, Paul Paul.Moore at atosorigin.com
Mon Oct 13 15:49:35 EDT 2003
From: Raymond Hettinger [mailto:raymond.hettinger at verizon.net]

> For Py2.4, I propose adding an optional list.sort() argument to
> support the decorate-sort-undecorate pattern.
[...]
 
> def sort(self, cmpfunc=None, decorator=None):

I like it! But "decorator" isn't a good name - it describes how it's
being done, rather than what is being done. How about "key"? After
all, "key=str.lower" reads more or less as "the key is the lowercase
equivalent of the value", and "key=ages.__getitem__" reads "get the
key by getting the appropriate item from the ages dictionary".

But names apart, it's nice. It lets people use the builtin, without
going for the performance-reducing comparison function...

Paul.

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