define a new func on the fly?

Costas Menico costas at meezon.com
Thu Mar 1 22:03:03 EST 2001


Gregory Jorgensen<gregj at pobox.com> wrote:

>eval() evaluates an expression. exec() executes a statement. Try this:
>
Here is the exact error I get when running it

>>>> exec("def f():\n\treturn 'hello'\t")
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "<string>", line 2
    return 'hello'
                  ^
SyntaxError: invalid syntax

I've trying all day to get this to work. No luck...

costas



More information about the Python-list mailing list