[Python-3000] None in Comparisons

Antoine Pitrou solipsis at pitrou.net
Tue Nov 11 15:27:57 CET 2008


M.-A. Lemburg <mal <at> egenix.com> writes:
> 
> NULLs are a fact in life, not only in SQL, but also in numerics and
> statistics. You often don't want a complex calculation or query to
> fail just because a few input values are not available.

But it only works in the case where you only do comparisons, and where
defaulting to "smaller than everything" is the right behaviour. Would you want
"None + 1" to return either 1 or None, rather than raising TypeError?

Also, it is trivial to write a list comprehension or generator expression that
filters all None values before doing the complex calculation or query.


Antoine.




More information about the Python-3000 mailing list