* Guido van Rossum <guido@python.org> [2002-05-24 12:59 -0400]: > Barry has added (with my consent :-) some additional style guidelines > to PEP 8. I welcome suggestions for more guidelines. I discourage > arguing over what's already in the PEP (it's a BDFL pronouncement, not > a democratic document). I'd add that checks for None should always be done using 'is (not) None'. Failing to do so has once bitten me. Proposed text (added to the 'Optimization and Other Programming Recommendations' section): Comparisions to singletons like the None builtin should always be done with 'is' or 'is not'. Rationale: This is slightly faster, and you don't have to care wether the left-hand object supports comparison to the singleton. Gerhard PS: IIRC the case were I was bitten was involving a __coerce__ special method that didn't support None, but I'm not sure any more. -- This sig powered by Python! Außentemperatur in München: 15.0 °C Wind: 2.9 m/s
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4