Michael Stephens wrote:
Our company has a scripting/macro system. Functions are stored in a database and at runtime we generate python classes. For a form we have multiple functions declared. We want to use IronPython studio to emit the python classes to a file to be debugged. Is it possible to build a partial class so that we can have one file per function.

Emit them as one file per function. Then have one file that imports them all and constructs a dictionary mapping function name to imported function. You can turn it into a class by calling:

new_class = type(name, (object,), dict_of_functions)

type is the default metaclass, and responsible for creating new classes. Every function will be a method of the new class.

Michael Foord
http://www.ironpythoninaction.com/



file function324.py
partial class Form76:
 def function324.py

file function325.py
partial class Form76
 def function324.py

file base325.py
 #do not edit anything in this file! changes will not be saved!


Michael Stephens

Electrical Engineering Graduate Student
University of Wyoming
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> or [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------------

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to