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

[Python-Dev] decorate-sort-undecorate

[Python-Dev] decorate-sort-undecorate [Python-Dev] decorate-sort-undecorateNeil Schemenauer nas-python at python.ca
Tue Oct 14 13:26:27 EDT 2003
On Tue, Oct 14, 2003 at 09:55:54AM -0700, Guido van Rossum wrote:
> If we're going to do a custom object, it should be a fixed-length
> struct containing (1) the key, (2) a C int of sufficient size to hold
> the record index; (3) a pointer to the record, and its comparison
> should only use (1) and (2).

I just thought of another reason why this is a good idea.  Imagine I
want to sort a list of objects that cannot be compared (e.g. complex
numbers).  I would expect

    cnums.sort(key = lambda n: n.real)

to work, not fail with an exception.

  Neil

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