Bruno Desthuilliers wrote:
> In python, assignement is a statement, not an expression, so there's no
> way you could write 'if obj = None' by mistake (-> syntax error). So
> this style is unpythonic. Also, None is a singleton, and identity test
> is way faster than equality test.

Playing Devil's advocate here: if you were to write "x!=None", then x's
__eq__ method is invoked, which might not account for the possibility
that the other operand is None.

However, if you write "None!=x", then None's __eq__ method is invoked,
which accounts for any given type.


Carl Banks

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to