very rare python expression
mail at timgolden.me.uk
Tue Aug 12 11:19:23 CEST 2008
> Howdy everyone,
> I saw a strange python code in pygame project. What does "while
> not(x&528or x in l):" mean? Below code works in python2.5, so "x&528"
> is not HTML strings.
Well I can't say I'd format it that way myself,
but it is valid. More conventionally laid out
the expression looks like this:
x & 528 or x in l
if x & 528:
elif x in l:
where x & 528 is the bitwise combination of x with 528.
Obviously the code you quote is taking the logical inverse
of this expression - "while not (...)"
More information about the Python-list