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

Chris Angelico rosuav at gmail.com
Tue Feb 18 22:11:40 CET 2014

On Wed, Feb 19, 2014 at 3:10 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> Sorry if this has already been suggested, but why not introduce a new
> singleton to make the database people happier if not happy?  To avoid
> confusion call it dbnull?  A reasonable compromise or complete cobblers? :)

That would be a major change to the DB API. Possibly the best
solution, though. Start off by having the default be to return None
(as now) and have a flag that can be set "please return sys.dbnull
instead" (does dbnull belong in sys?), and let that settle for a few
years. Recommend that all applications explicitly set the flag, either
to True or to False. Then eventually, with the full deprecation
warnings, change the default to True. (Or maybe make it an error to
not set it.) Then, after another long round of deprecations, drop the
None behaviour from the spec altogether.

But even in its early steps, that could solve the problem. Anyone who
wants to sort a list of tuples that came from the database can simply
set the flag (assuming their back-end supports that flag) and happily
use dbnull.


More information about the Python-Dev mailing list