Re: [Tutor] Dynamically naming functions

2006-03-27 Thread Ed Singleton
On 26/03/06, Kent Johnson [EMAIL PROTECTED] wrote: 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

Re: [Tutor] Dynamically naming functions

2006-03-26 Thread Kent Johnson
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

Re: [Tutor] Dynamically naming functions

2006-03-15 Thread Alan Gauld
Very rarely, its easy to do backups of huge amounts of data if you know where to find it, its hard to trawl all over a changing structure looking for the things that need backing up. Particularly if, when you try to restore it, it needs to go in a different place to where you found

Re: [Tutor] Dynamically naming functions

2006-03-14 Thread Ed Singleton
On 13/03/06, Alan Gauld [EMAIL PROTECTED] wrote: For website, I can't really see how I can not have a dynamic structure. There's no way I'm writing a function for each folder. Hmm, this may be a CherryPie concept thing but the vast majority of websites do not have dynamic structures. It

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Ed Singleton
On 10/03/06, Kent Johnson [EMAIL PROTECTED] wrote: 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

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Kent Johnson
Ed Singleton wrote: On 10/03/06, Kent Johnson [EMAIL PROTECTED] wrote: Ed Singleton wrote: 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 =

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Ed Singleton
On 10/03/06, Alan Gauld [EMAIL PROTECTED] 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). First point, names of functions are no different to

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Kent Johnson
Ed Singleton wrote: On 10/03/06, Alan Gauld [EMAIL PROTECTED] wrote: Dynamic site structure shouldn't need dynamic creation of functions although the structure might need to be dynamically loaded into a data structure in the code. It might also be a parameter of the functions. Doesn't

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Kent Johnson
Kent Johnson wrote: Why not just use nested dicts? MyProject = dict( start = 2006-03-06, resource = Me, Task1 = dict(start = 2006-03-13), Task2 = dict(effort = 1w), ) or nest class instances directly: MyProject = Project( start = 2006-03-06, resource = Me, Task1

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Ed Singleton
On 13/03/06, Kent Johnson [EMAIL PROTECTED] wrote: Ed Singleton wrote: On 10/03/06, Kent Johnson [EMAIL PROTECTED] wrote: Ed Singleton wrote: 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

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Kent Johnson
Ed Singleton wrote: On 13/03/06, Kent Johnson [EMAIL PROTECTED] wrote: I've just discovered with a little playing, that you can do: def z(v): ... def f(x): ... print x * v ... return f ... c = z(3) c(1) 3 funcdict = dict(foo = z(4)) funcdict[foo](1) 4

Re: [Tutor] Dynamically naming functions

2006-03-13 Thread Alan Gauld
For website, I can't really see how I can not have a dynamic structure. There's no way I'm writing a function for each folder. Hmm, this may be a CherryPie concept thing but the vast majority of websites do not have dynamic structures. It really shouldn't be necessary. Why would you need to

[Tutor] Dynamically naming functions

2006-03-10 Thread Ed Singleton
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

Re: [Tutor] Dynamically naming functions

2006-03-10 Thread Kent Johnson
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

Re: [Tutor] Dynamically naming functions

2006-03-10 Thread Alan Gauld
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). First point, names of functions are no different to names of other things. def f(x): y = blah

Re: [Tutor] Dynamically naming functions

2006-03-10 Thread Danny Yoo
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