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

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

[Python-Dev] python 3 niggle: None < 1 raises TypeErrorMRAB python at mrabarnett.plus.com
Tue Feb 18 15:11:38 CET 2014
On 2014-02-18 13:48, Serhiy Storchaka wrote:
> 18.02.14 10:10, Paul Moore написав(ла):
>> Or alternatively, a "default on None" function - Oracle SQL calls this
>> nvl, so I will too:
>>
>> def nvl(x, dflt):
>>      return dflt if x is None else x
>>
>> results = sorted(invoices, key=lambda x: nvl(x.duedate, datetime(MINYEAR,1,1))
>
> Or, as was proposed above:
>
> results = sorted(invoices,
>                    key=lambda x: (x.duedate is not None, x.duedate))
>
That makes me wonder.

Why is:

     None < None

unorderable and not False but:

      (None, ) < (None, )

orderable?
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