[FRPythoneers] Python documentation and default expression

Rob Riggs rob at pangalactic.org
Fri Mar 15 14:39:46 MST 2002


Where do I find Pythons rules for the default tests on a variable? I.e., 
when I have an expressions like:

    if foo: ...

what are the tests on "foo" that are performed? Is this documented in 
the language reference anywhere?

Along the same lines, what are the thoughts on using this type of test 
in code? The reason I ask is that I was just burned on a test like this 
when I extended a class to include a __len__() member function. What I 
really wanted to test was that the class wasn't "None", and using the 
above idiom worked well for that. At least it did until I added __len__().

-Rob





More information about the FRPythoneers mailing list