<br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 10:36 PM, Zhongyue Luo <span dir="ltr"><<a href="mailto:zhongyue.nah@intel.com" target="_blank">zhongyue.nah@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div><div>Hi, all<br><br></div><div>After submitting a patch to fix some "if not X in Y" to "if X not in Y", I got advice from someone that we should first ask everyone about their preference between "if X not in Y" and "if not X in Y".<br>


<br></div><div>I have many reasons why we should use "if X not in Y", but lets first look at some statistics.<br><br></div><div>In the ten major project of OpenStack (oslo, nova, glance, keystone, quantum, cinder, swift, horizon, ceilometer, tempest - personal thought), the occurrence of "if X not in Y" is 560 compared to the 152 of "if not X in Y".<br>


<br><a href="https://etherpad.openstack.org/notin" target="_blank">https://etherpad.openstack.org/notin</a><br><br></div><div>So I guess it is fair to say that the implied consensus of how to evaluate an element in a iterable is "if X not in Y".<br>


</div><br></div><div>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.<br></div><div><br></div>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?<span class="HOEnZb"><font color="#888888"><br>


<div><div><br>-- <br><div><b>Intel SSG/SSD/SOTC/PRC/CITT</b></div>
<div>880 Zixing Road, Zizhu Science Park, Minhang District, Shanghai, 200241, 
China<br></div>
<div><a href="tel:%2B862161166500" value="+862161166500" target="_blank">+862161166500</a></div>
</div></div></font></span></div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><div>Personally I'm a fan of consistency for things such as this and IMO "if x not in y" is correct.  I'm fine with adding it to hacking in Cinder at any rate.</div><div><br></div>

<div>John</div>