you can also add methods to an existing class like this:<br><br>class A(object):<br>&nbsp;&nbsp;&nbsp; ...<br><br>def foo(self,x,y):<br>&nbsp;&nbsp;&nbsp; ...<br><br>A.foo = foo<br><br><div class="gmail_quote">On Fri, Jun 13, 2008 at 3:22 PM, Michael Foord &lt;<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Michael Stephens wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Our company has a scripting/macro system. &nbsp;Functions are stored in a database and at runtime we generate python classes. &nbsp;For a form we have multiple functions declared. &nbsp;We want to use IronPython studio to emit the python classes to a file to be debugged. &nbsp;Is it possible to build a partial class so that we can have one file per function.<br>

</blockquote>
<br></div>
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:<br>
<br>
new_class = type(name, (object,), dict_of_functions)<br>
<br>
type is the default metaclass, and responsible for creating new classes. Every function will be a method of the new class.<br>
<br>
Michael Foord<br>
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
<br>
file function324.py<br>
partial class Form76:<br>
&nbsp;def function324.py<br>
<br>
file function325.py<br>
partial class Form76<br>
&nbsp;def function324.py<br>
<br>
file base325.py<br>
&nbsp;#do not edit anything in this file! changes will not be saved!<br>
<br>
<br>
Michael Stephens<br>
<br>
Electrical Engineering Graduate Student<br>
University of Wyoming<br>
</div><a href="mailto:falcon@uwyo.edu" target="_blank">falcon@uwyo.edu</a> &lt;mailto:<a href="mailto:falcon@uwyo.edu" target="_blank">falcon@uwyo.edu</a>&gt; or <a href="mailto:89iroc@gmail.com" target="_blank">89iroc@gmail.com</a> &lt;mailto:<a href="mailto:89iroc@gmail.com" target="_blank">89iroc@gmail.com</a>&gt;<div class="Ih2E3d">
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
 &nbsp;<br>
</div></blockquote><div><div></div><div class="Wj3C7c">
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br>