variable hell

rafi rafi at
Thu Aug 25 22:15:11 CEST 2005

Reinhold Birkenfeld wrote:

>>>  exec(eval("'a%s=%s' % (count, value)"))
>>why using the eval?
>>exec ('a%s=%s' % (count, value))
>>should be fine
> And this demonstrates why exec as a statement was a mistake ;)
> It actually is
> exec 'a%s=%s' % (count, value)


In the meantime another question I cannot find an answer to: any idea 
why does eval() consider '=' as a syntax error?

 >>> eval ('a=1')
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "<string>", line 1
SyntaxError: invalid syntax



	"Imagination is more important than knowledge."
	                            (Albert Einstein)

More information about the Python-list mailing list