Modifying signature of ctor in class

gal kauffman gal.kauffman at
Thu Sep 24 22:37:35 CEST 2015

You can use the FunctionType class found in the types module (and its
friends) to create functions on the run.
And you can use the 'inspect' module to inspect existing functions, if you
need to base the new function on an existing one.
On Sep 24, 2015 11:28 PM, "Joseph L. Casale" <jcasale at>

> I have a class factory where I dynamically add a constructor to the class
> output.
> The method is a closure and works just fine, however to accommodate the
> varied
> input its signature is (*args, **kwargs).
> While I modify the doc strings, the ctor sig is not optimal. Without
> building
> this a string and using eval, is there anything that can be done about
> this?
> Thanks,
> jlc
> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list