Need help with Python class idioms
Paul McGuire
ptmcg at users.sourceforge.net
Wed Jan 21 18:18:40 EST 2004
"Jonathan Daugherty" <cygnus at cprogrammer.org> wrote in message
news:mailman.611.1074719029.12720.python-list at python.org...
> # 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.
>
> --
>
> Jonathan Daugherty
> http://www.cprogrammer.org
>
> "It's a book about a Spanish guy called Manual, you should read it."
> -- Dilbert
>
... what if mandatoryVar1 was set to False?
-- Paul
More information about the Python-list
mailing list