def <dynamic function name> () syntax ?

Bruce Edge bedge at troikanetworks.com
Wed Apr 4 12:52:11 EDT 2001


Can the follwoing be accomplished in Python?

I want to create a func named "abc":

>>> name="abc"

>>> eval ("name")
'abc'

>>> def eval ("name") ():
  File "<stdin>", line 1
    def eval ("name") ():
                   ^
SyntaxError: invalid syntax


Thanks, Bruce.



More information about the Python-list mailing list