diff options
author | Nguyen Phuong An <AnNP@vn.fujitsu.com> | 2016-08-29 18:15:30 +0700 |
---|---|---|
committer | Nguyen Phuong An <AnNP@vn.fujitsu.com> | 2016-09-14 16:23:32 +0700 |
commit | 9afb9ca5982bc1a04aa0d9641f8337286882bfb5 (patch) | |
tree | 5d9a311707c01524d2abe4f6daaf3ed4c8732836 /HACKING.rst | |
parent | 9a2e0b76694ffecc3fd1cea7200229c8e5ed472a (diff) | |
download | neutron-9afb9ca5982bc1a04aa0d9641f8337286882bfb5.tar.gz |
Prevent use filter(lambda obj: test(obj), data)
In Python3 [1], if we need filter on python3, replace
filter(lambda obj: test(obj), data) with:
[obj for obj in data if test(obj)]. This patch replaces
filter function and introduces a hacking rule to prevent
using filter in future.
[1] https://wiki.openstack.org/wiki/Python3
Change-Id: I83d22108c02f8da007a7233e71a4a7fb833170ec
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index 347c0d4a59..5554ca9262 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -29,6 +29,8 @@ Neutron Specific Commandments - [N340] Check usage of <module>.i18n (and neutron.i18n) - [N341] Check usage of _ from python builtins - [N342] String interpolation should be delayed at logging calls. +- [N344] Python 3: Do not use filter(lambda obj: test(obj), data). Replace it + with [obj for obj in data if test(obj)]. Creating Unit Tests ------------------- |