how to set doc-string of new-style classes

H

harold fellermann

Hello,

does anyone know a way to set the __doc__ string of a new style class?
Any attempt I tried results in the following error:

Python 2.4 (#1, Dec 30 2004, 08:00:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information..... pass
....Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: attribute '__doc__' of 'type' objects is not writable

I can understand someone arguing that "changing a doc string is during
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.

- harold -
 
A

Alex Martelli

harold fellermann said:
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.
'hi there'



Alex
 
P

Peter Otten

harold said:
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:
'what you want'

Peter
 
H

harold fellermann

'hi there'

yes, you're right ... a subsequent question, that puzzles me:
where can I apply for the "most-stupid-question"-award, now *g*

thanks anyway,

- harold -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top