Need help with Python class idioms

James Henderson james at logicalprogression.net
Wed Jan 21 22:24:48 CET 2004


On Wednesday 21 January 2004 9:01 pm, Jonathan Daugherty wrote:
> # P.S. Since you're asking about idiom, it would be more Pythonic to write:
> #
> #     if self.mandatoryVar1 is None:
> #
> # using the identity test "is" rather than equality test "==", since there
> is # only one None.
>
> I'd write
>
>   if not self.mandatoryVar1:
>
> but the first method works, too.

Are you sure an empty sequence or zero aren't valid values?  J.
-- 
James Henderson, Logical Progression Ltd.
http://www.logicalprogression.net/
http://sourceforge.net/projects/mailmanager/





More information about the Python-list mailing list