'if foo' calls getattr?!?
moshez at server.python.net
Tue Aug 31 01:50:42 EDT 1999
On Tue, 31 Aug 1999, Moshe Zadka wrote:
> Bzzt! foo!=None is slower then foo is not None, but not by much: it will
> first check whether type(foo) is not type(None), so it is pretty fast.
> truth-and-nothing-are-always-popular-subjects-ly y'rs, Z.
Sorry to reply to my own posts, but there was a mistake: foor!=None will
make a call to __getattr__ for __cmp__, so it will be very slow.
oops-ly y'rs, Z.
More information about the Python-list