[openstack-dev] "if X not in Y" vs. "if not X in Y" consensus?

Jason Kölker jason at koelker.net
Thu Jan 31 06:34:58 UTC 2013


On Wed, Jan 30, 2013 at 11:36 PM, Zhongyue Luo <zhongyue.nah at intel.com> wrote:
> What I'm suggesting is that we should add an entry in HACKING.rst stating we
> should use "if X not in Y" and prevent mix use of the two.
>
> Would there be any reason why we shouldn't do this? such as it adds more
> burden to reviewers, or because we should have the freedom to choose
> whatever we want to use?

+1 for adding it to the guidelines. The "not in" expression is the
correct way to test for collection membership
(http://docs.python.org/2.7/reference/expressions.html#not-in).

Happy Hacking!

7-11



More information about the OpenStack-dev mailing list