Misuse of the "not in" python syntax

Bug #1110058 reported by Zhongyue Luo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Zhongyue Luo

Bug Description

There are some lines in the code which uses "if not X is Y"

It should be fixed to "if X is not Y"

ML discussion held at http://lists.openstack.org/pipermail/openstack-dev/2013-January/005243.html

Tags: quantum-core
Zhongyue Luo (zyluo)
Changed in quantum:
assignee: nobody → Zhongyue Luo (zyluo)
Revision history for this message
Maru Newby (maru) wrote :

Can you please clarify the description of this bug? The two statements listed are logically equivalent, and there is no project documentation (say, in HACKING.rst) that requires one or the other.

Revision history for this message
Zhongyue Luo (zyluo) wrote :

Maru,

Yes the two statements are logically equivalent.

However in terms of readability, the "is not" keyword is more friendlier to the reader compared to "not X is Y"

I am also planning to write this in HACKING.rst.

Changed in quantum:
status: New → In Progress
tags: added: quantum-core
Zhongyue Luo (zyluo)
Changed in quantum:
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/20884

Changed in quantum:
status: Invalid → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/20884
Committed: http://github.com/openstack/quantum/commit/4ab676fc4f98f2b67e7b1ae7dbed657d602a95a1
Submitter: Jenkins
Branch: master

commit 4ab676fc4f98f2b67e7b1ae7dbed657d602a95a1
Author: Zhongyue Luo <email address hidden>
Date: Thu Jan 31 16:08:26 2013 +0800

    Fixes 'not in' operator usage

    Fixes bug #1110058

    Change-Id: I45c10097abfb929918925e7befb8ed6c36b1de1c

Changed in quantum:
status: In Progress → Fix Committed
Revision history for this message
Akihiro Motoki (amotoki) wrote :

@zyluo
Could you file another bug to add it to HACKING.rst?

Moreover, it would be better we have a pointer to the discussion on ML in the bug report.

Changed in quantum:
milestone: none → grizzly-3
importance: Undecided → Low
Revision history for this message
Zhongyue Luo (zyluo) wrote :

@amotoki: will do.

description: updated
Revision history for this message
Zhongyue Luo (zyluo) wrote :

@amotoki: Oh but mnewby is againt adding this rule to HACKING.rst. However it is already added in the HACKING.rst of oslo, nova, cinder, glance and keystone. Maybe we can talk about it today at the IRC meeting.

Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.