Steven Howe wrote: > Alan G Isaac wrote: >> >>> None >= 0 >> False >> >>> None <= 0 >> True >> >> Explanation appreciated. >> >> Thanks, >> Alan Isaac >> > I've read and found that 'None' comparisons is not always a good idea. > Better to: > from types import NoneType > > x = None > if type( x ) == NoneType: > # true > < code > > else: > # false; do something else. > < more code >
The recommended idiom is to test for "x is None". -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list