ACCEPTED: PEP 285
Hernan M. Foffani
hfoffani at yahoo.com
Thu Apr 4 06:41:46 EST 2002
"Andrew Dalke"
> ....
> if self.connections.has_key(occasion) == 0:
>
> when it should have said
> if not self.connection.has_key(occasion):
>
> I know this will still work correctly since False == 0,
> but I suspect this means there's many people who are doing
> explicit checks for 0/1 (/whatever?) for truth tests.
>
While at this moment it's not possible to realiable check
for those constructions, it's interesting to note that
pychecker (in Python 2.3) will issue a warning!
I'm not convinced that PEP285 will hassle newbies.
Actually, I even think that it can improve code style.
Regards,
-Hernan
More information about the Python-list
mailing list