[Tutor] Dynamically naming functions

Kent Johnson kent37 at tds.net
Sun Mar 26 13:43:08 CEST 2006


Ed Singleton wrote:
> How does one go about creating functions, classes, or callable objects
> when you don't know their name in advance? (For example you want to
> read their names in from a text file or database).
> 
> I want to use this in a few different places.  For example Faces, the
> Python Project Management Planner Tool Thingy, uses nested functions
> to put tasks within a project:
> 
> def MyProject():
>     start = "2006-03-06"
>     resource = Me
> 
>     def Task1():
>         start = "2006-03-13"
> 
>     def Task2():
>         effort = "1w"
> 
> I'd like to load these from a database (using SQLObject), but I'm not
> sure how I can define the name of the function from a filed in a
> database (or read in from a text file).

Hi Ed,

I was just wondering how this came out - did you find a way to generate 
these functions dynamically? Or change Faces? Or give up?

Thanks,
Kent



More information about the Tutor mailing list