question of style

Paul Rubin http
Thu Jul 2 20:57:15 EDT 2009


Tim Harig <usernet at ilthio.net> writes:
> > Well, that assert is not right because you have to handle the case
> > where one of the values is None...  
> Sorry, it worked under 2.5:

Well, it didn't crash under 2.5.  Whether the result was correct
is a different question.  

> None seems to have been evaluated less then any integer.  The same isn't
> true under 3.0:

But the original code didn't specify the non-None values to be
integers.  Really, it's unwise to rely on an ordering relation between
None and values of arbitrary other types, unless supportable by a
clear specification, but even then, it's a code smell.

> 3.0	TypeError: unorderable types: NoneType() <= int()

That is far preferable to what 2.x does.



More information about the Python-list mailing list