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/2014-February/132333.html below:

[Python-Dev] python 3 niggle: None < 1 raises TypeError

[Python-Dev] python 3 niggle: None < 1 raises TypeError [Python-Dev] python 3 niggle: None < 1 raises TypeErrorNick Coghlan ncoghlan at gmail.com
Fri Feb 14 10:29:05 CET 2014
On 14 February 2014 18:04, Chris Withers <chris at simplistix.co.uk> wrote:
>
> Am I missing something? How can I get this method down to a sane size?

The easiest way is usually to normalise the attributes to a sensible
numeric value depending on where you want "None" to sort (positive and
negative infinity floating point values often work well in the case of
numeric data, but a custom AlwaysLess or AlwaysGreater type works for
arbitrary data). You can either do that dynamically, or else cache the
normalised values when the attributes are set.

Python 2 used to guess, Python 3 makes developers decide how they want
None to be handled in the context of ordering operations.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
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