define a new func on the fly?

Bruce Edge bedge at troikanetworks.com
Thu Mar 1 19:28:23 EST 2001


I'm trying to define a new function on the at runtime,

this fails:

>>> eval( "def global_func_name():\n\tpass" )
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 1
    def global_func_name():
      ^
SyntaxError: invalid syntax

any idea how I can do this?



Thanks, Bruce.



More information about the Python-list mailing list