Need help with Python class idioms
Jonathan Daugherty
cygnus at cprogrammer.org
Wed Jan 21 16:01:42 EST 2004
# 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
More information about the Python-list
mailing list