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

Clark, Robert Graham robert.clark at hp.com
Thu Jan 31 15:17:33 UTC 2013


+1 for "X not in Y"

 

"not X in Y" requires one who doesn't code python every day to stop and
think, "X not in Y" is largely unambiguous.

 

From: Dolph Mathews [mailto:dolph.mathews at gmail.com] 
Sent: 31 January 2013 14:53
To: OpenStack Development Mailing List
Subject: Re: [openstack-dev] "if X not in Y" vs. "if not X in Y" consensus?

 

+1 for "X not in Y"

 

"not X in Y" reads ambiguously to me.




 

-Dolph

 

On Thu, Jan 31, 2013 at 8:45 AM, Ray Pekowski <pekowski at gmail.com> wrote:

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?  :-)


_______________________________________________
OpenStack-dev mailing list
OpenStack-dev at lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130131/09d9aa95/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6190 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130131/09d9aa95/attachment.bin>


More information about the OpenStack-dev mailing list