[EMAIL PROTECTED] wrote: > On Apr 18, 3:19 pm, Steven Howe <[EMAIL PROTECTED]> wrote: >> 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 > >> >> Steven Howe > > Is that any better than this? > > if x is None: > # do something > else: > # do something else
To the contrary, it's not as good. "if x is None" is much clearer, and probably faster. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list