strange SyntaxError

Attila Szabo trial at ugyvitelszolgaltato.hu
Fri Feb 25 08:33:55 EST 2005


Hi,

I wrote this sample piece of code:
                                                  
def main():
        lambda x: 'ABC%s' % str(x)
        for k in range(2): exec('print %s' % k)

main()

With the lambda line, I get this:
SyntaxError: unqualified exec is not allowed in function 'main'
it contains a nested function with free variables
Without the lambda, it's ok...
     
What's this ?

thanks

-- 

A t t i l a :: trial at ugyvitelszolgaltato.hu :: S z a b o




More information about the Python-list mailing list