On 11-Jan-11, at 8:47 PM, Nitin Kumar wrote:
[snip]
So i do know who to create a class and its function dynamically at
runtime???

You can dynamically create a class like this:

NewClass = type('NewClass', (object,), {})

where 'NewClass' is the name of your class, (object,) is any tuple of superclasses and {} will be the __dict__ of the new class. As steve mentioned earlier, you can reassign any "method" of the class to a function of your choice as long as it takes at least one argument.

-Taj.
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to