Re: Need to generate some functions.

2007-08-17 Thread J. Robertson
you can use the dictionary returned by the built in function vars, along the lines of >>> vars()["foo"] = lambda x: 3*x >>> foo(2) 6 but polluting your name space with data counts as bad style and will probably bite you at some point -- you probably are better of putting closures in a dictio

Need to generate some functions.

2007-08-17 Thread Steven W. Orr
Given a list of names ll = ("n1", "n2", "n3", "n4") I want to create a pair of functions based off of each name. An example of what I want to happen would look like this: def mkn1dict(address): return {'Address': address, 'Control': SOME_CONST} def mkn1Classobj(address): return Class