<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">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?<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>+862161166500</div>
</div></div></div>