[SciPy-dev] Generic polynomials class (was Re: Volunteer for Scipy Project)

Charles R Harris charlesr.harris at gmail.com
Thu Oct 15 13:45:29 EDT 2009


Just to throw another stick into the fire, I note that it is possible to
reuse the same toplevel code while creating classes that derive from
different bases. Using the type metaclass it goes something like this:

class_code_text = """blah blah blah"""
class_dict = {}
exec class_code_text in globals(), class_dict

MyVerySpecialClass = type("MyVerySpecialClass",  (MyBasis,),  class_dict)

<big snip>

I think the first three lines could be in their own module.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20091015/1b94b4bc/attachment.html>


More information about the SciPy-Dev mailing list