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

Dean Troyer dtroyer at gmail.com
Thu Jan 31 16:19:51 UTC 2013


On Thu, Jan 31, 2013 at 9:57 AM, Vishvananda Ishaya
<vishvananda at gmail.com> wrote:

> The in operator has precedence over not so to have not be an operator on X
> you would need:
>
> (not X) in Y

Ugh.

"It's morning" I thought
"I'll just look this up" I thought
"Yup, 'boolean not' is above 'in' (and the other operators) in the
table" I thought, without actually looking at the table and noticing
that it's backwards from every other operator precedence table I've
looked at and written
"Python can't have more than one way to do this" I thought

Wrong.

/me going back to get more caffeine...

dt

-- 

Dean Troyer
dtroyer at gmail.com



More information about the OpenStack-dev mailing list