diff options
author | Rick Harris <rconradharris@gmail.com> | 2012-03-21 21:18:43 +0000 |
---|---|---|
committer | Rick Harris <rconradharris@gmail.com> | 2012-03-21 21:18:46 +0000 |
commit | 66e152f718f227ebb830fd325685103c50234d99 (patch) | |
tree | f8f16450f925d62ab5a0ca7b27c3106d4fc57177 /HACKING.rst | |
parent | 521108d5b91d7a7aa2ff1e594f3dc48d0c2a7311 (diff) | |
download | nova-66e152f718f227ebb830fd325685103c50234d99.tar.gz |
Clarify HACKING's shadow built-in guidance.
Change-Id: Icf38d3ec3254e83d2289b7b17966ec44d9757b8c
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/HACKING.rst b/HACKING.rst index b7e2564d69..4d9a1b3f2c 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -12,7 +12,18 @@ General - Put one newline between methods in classes and anywhere else - 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 +- Do not shadow a built-in or reserved word. Example:: + + def list(): + return [1, 2, 3] + + mylist = list() # BAD, shadows `list` built-in + + class Foo(object): + def list(self): + return [1, 2, 3] + + mylist = Foo().list() # OKAY, does not shadow built-in Imports |