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

Ray Pekowski pekowski at gmail.com
Thu Jan 31 14:45:03 UTC 2013


On Thu, Jan 31, 2013 at 1:23 AM, Zhongyue Luo <zhongyue.nah at intel.com>wrote:

> Ray, we are only considering in cases when evaluation of membership is
> needed.
>
> The "if not flag" is an boolean evaluation of "flag" itself and has
> nothing to do with dict.
>
>
In that case, I (sarcastically) promote a counter proposal for negating a
dictionary membership check.  It must be done in two lines, as follows:

flag = key in dict
if not flag:

The following forms are disallowed due to the desire for conformity:  "if
key not in dict" and "if not key in dict".

Votes?  :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130131/601da6b4/attachment.html>


More information about the OpenStack-dev mailing list