Peter Otten wrote:

> Use 
> 
> eval(s) 
> 
> to evaluate an expression and 
> 
> exec s
> 
> to execute a statement.

I never thought of using compile() to get around this before. Now I can 
finally use print in my lambda functions! Just think of the horrible 
code I could write:

f = lambda x: eval(compile("print %s" % x, "<string>", "exec"))
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to