class constructors: class vs. instance defaults

Michael Hoffman m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Thu Oct 7 18:37:07 EDT 2004


Steven Bethard wrote:
> Note that (x is not None) evaluates to True, not x.  Note that you can't solve 
> this by introducing an 'and' either because {} evaluates to False in a boolean 
> context:

Right. However you can do [x, {}][x is None].

But please don't! <double wink>
-- 
Michael Hoffman



More information about the Python-list mailing list