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

Nick Coghlan ncoghlan at gmail.com
Fri Feb 14 11:42:13 CET 2014


On 14 February 2014 20:30, Paul Moore <p.f.moore at gmail.com> wrote:
> On 14 February 2014 10:20, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Hmm, it seems you're right, but I'm quite sure some DBMSes have a
>> consistent way of ordering NULLs when using ORDER BY on a nullable
>> column.
>
> ORDER BY xxx [NULLS FIRST|LAST] is the syntax in Oracle, with (IIRC)
> NULLS LAST as default. But I agree, this is not an argument in favour
> of doing the same in Python.

IIRC, MySQL and PostgreSQL sort them in the opposite order from each
other (or it's possibly just Teiid's PostgreSQL emulation that is the
opposite of MySQL).

Either way, it nicely illustrates *why* we didn't grant None an
exemption from the "no implicit cross-type ordering operations" in
3.x. It does make *adapting* to other models like SQL a bit more
painful though. That's the main reason I still occasionally wonder if
"AlwaysMin" and "AlwaysMax" singletons might make sense, although that
approach has problems of its own (specifically, it's hard to actually
use without breaking the clean NULL -> None mapping and in many cases
+/- infinity already work fine).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list