甜瓜 wrote:
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

meaning:

if x & 528:
  return True
elif x in l:
  return True
else:
  return False

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 (...)"

TJG

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to