Is 0 > None??

brueckd at tbye.com brueckd at tbye.com
Fri Aug 31 10:10:07 EDT 2001


Hi Manus,

On Fri, 31 Aug 2001, Manus Hand wrote:

> Now I know that maybe I shouldn't have written code that depends on
> where None compares to the integer values,

Bingo. IMO, it's too bad that it changed and broke your code, but relying
on None comparing to an integer a particular way is Sick and Wrong. ;-)
You're not even comparing apples and oranges; it's like asking if the
color blue is less than my left shoe.

> Would it be possible to get a permanent decision on this one, please?

Sure! How about this: "No integer is equal to None (testing for equality
always returns false), and the results of other integer-to-None comparison
operations are undefined."

The real solution is to fix your code. Readable, explicit code almost
always beats nifty magic tricks.

-Dave





More information about the Python-list mailing list