[openstack-dev] [trove][neutron][cinder][swift][ceilometer][nova][keystone][sahara][glance][neutron-lbaas][imm] stylistic changes to code, how do we handle them?

David Stanek dstanek at dstanek.com
Tue Jan 12 14:19:18 UTC 2016


On Tue, Jan 12, 2016 at 9:13 AM, Amrith Kumar <amrith at tesora.com> wrote:

> Chris, Ihar,
>
> I assumed that this was stylistic based on the fact that in the places
> where I was seeing it, it seemed to be the case that the LHS was
> intuitively positive (a length, for example). I did not exhaustively verify
> this but yes, you are correct, the construct
>
>         If var
>
> is the same as  (I believe)
>
>         if var is not None


Those two statements are also not the same. 'if var' will be True is 'var'
is *only* True values. 'if var is not None' will be True *everything*
except None, so 0, '', [], etc. will not pass the first test, but will pass
the second.



-- 
David
blog: http://www.traceback.org
twitter: http://twitter.com/dstanek
www: http://dstanek.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160112/1159f3c9/attachment.html>


More information about the OpenStack-dev mailing list