summaryrefslogtreecommitdiff
path: root/HACKING.rst
diff options
context:
space:
mode:
authorGary Kotton <gkotton@vmware.com>2015-10-29 07:40:05 -0700
committerGary Kotton <gkotton@vmware.com>2015-10-29 07:57:31 -0700
commit2b7fb6ff08a49618ee441f80b07bd622e1ee0b1b (patch)
tree6a1be037d56eb5f57eb26016114a3b5eaa6beef3 /HACKING.rst
parent6af52340ff1da075e0b03b089d24d197e33ece3f (diff)
downloadneutron-2b7fb6ff08a49618ee441f80b07bd622e1ee0b1b.tar.gz
Removes the use of mutables as default args
Passing mutable objects as default args is a known Python pitfall. We'd better avoid this. This commit changes mutable default args with None, then use 'arg = arg or {}', 'arg = arg or []'. For unit code which doesn't use the args , just set with None. This commit also adds hacking check. This code was taken from commit 0bea84ac20fe498bd08f7212a0017196c8cb0812 in Nova. Change-Id: I36d07cade687690dc02a8f6cc3d70f5d00caf112 Co-Authored-By: ChangBo Guo(gcb) <glongwave@gmail.com>
Diffstat (limited to 'HACKING.rst')
-rw-r--r--HACKING.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst
index 6b9df25901..0eade2778f 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -18,6 +18,7 @@ Neutron Specific Commandments
- [N326] Python 3: do not use basestring.
- [N327] Python 3: do not use dict.iteritems.
- [N328] Detect wrong usage with assertEqual
+- [N329] Method's default argument shouldn't be mutable
Creating Unit Tests
-------------------