how to set doc-string of new-style classes

Peter Otten __peter__ at web.de
Tue Jan 11 13:37:46 EST 2005


harold fellermann wrote:

> programm execution and should therefore be forbidden!" But, I cannot
> even find out a way to set the doc string, when I CREATE a class using
> type(name,bases,dict) ... At least this should be possible, IMHO.

That's what the dict parameter is for:

>>> T = type("T", (object,), dict(__doc__="what you want"))
>>> T.__doc__
'what you want'

Peter





More information about the Python-list mailing list