Dynamic generation of doc-strings of dynamically generated classes

Mikael Olofsson mikael at isy.liu.se
Tue Oct 18 09:23:41 CEST 2005


Alex Martelli wrote:
> The best way to make classes on the fly is generally to call the
> metaclass with suitable parameters (just like, the best way to make
> instances of any type is generally to call that type):
> 
> derived = type(base)('derived', (base,), {'__doc__': 'zipp'})

and George Sakkis said something similar.

Thanks, both of you. As I expected, there was a much better way than my 
clumsy way. Anyway, this took me to section 3.3.3 in the reference 
manual, and that will help me further.

Thanks again. Back to the keyboard!

/MiO



More information about the Python-list mailing list