True, False, None (was re. Pruss's manifesto)

Kristian Ovaska kristian.ovaska at helsinki.fi
Wed Nov 12 14:02:10 EST 2003


Skip Montanaro <skip at pobox.com>:
>    while True:
>        foo()
>how do you know that foo() doesn't twiddle Python's builtins?

If could also happen in the loop, right in front of the compiler's
observing eye:

def fun():
    import __builtin__
    return (setattr, __builtin__, 'True', 0)

while True:
    f, builtins, name, value = fun()
    f(builtins, name, value)

I recall from theory courses that determining any nontrivial semantic
feature of a program is, in the general case, impossible. Maybe
static-binding languages give enough hints in the syntax that some
analyzis could be done, but Python is very dynamic...

-- 
Kristian Ovaska - http://www.cs.helsinki.fi/u/hkovaska/




More information about the Python-list mailing list