[Python-Dev] decorate-sort-undecorate
Ian Bicking
ianb at colorstudy.com
Mon Oct 13 17:29:01 EDT 2003
On Monday, October 13, 2003, at 02:34 PM, Raymond Hettinger wrote:
> For Py2.4, I propose adding an optional list.sort() argument to
> support the decorate-sort-undecorate pattern.
I've seen proposals for an extension to list comprehension, which would
be quite nice:
[s for s in lst sortby s.lower()]
It reads nicely, and avoids lambdas and tiny helper functions. Also
handles the sort-returns-None criticism. But it adds syntax. And
since it's not an in-place sort it won't perform as well (but probably
better than the decorator idiom anyway...?)
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Python-Dev
mailing list