Merge "Update HACKING.rst per recent changes"

This commit is contained in:
Jenkins 2013-02-12 05:21:17 +00:00 committed by Gerrit Code Review
commit dee3e8f14a

View File

@ -13,15 +13,23 @@ General
- Do not write "except:", use "except Exception:" at the very least
- Include your name with TODOs as in "#TODO(termie)"
- Do not name anything the same name as a built-in or reserved word
- Use the "not in" operator for collection membership evaluation. Example::
- Use the "is not" operator when testing for unequal identities. Example::
if not X in Y: # BAD, hard to understand
if not X is Y: # BAD, intended behavior is ambiguous
pass
if X is not Y: # OKAY, intuitive
pass
- Use the "not in" operator for evaluating membership in a collection. Example::
if not X in Y: # BAD, intended behavior is ambiguous
pass
if X not in Y: # OKAY, intuitive
pass
if not (X in Y or X is Z): # OKAY, still better than all those 'not's
if not (X in Y or X in Z): # OKAY, still better than all those 'not's
pass