Re: very rare python expression

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Golden

    Re: very rare python expression

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

Working...