class constructors: class vs. instance defaults

Michael Hoffman at
Fri Oct 8 00:37:07 CEST 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