docstring that use globals?

kj no.email at please.post
Sat Oct 16 13:05:20 EDT 2010


In <i9clfa$mk7$1 at reader1.panix.com> kj <no.email at please.post> writes:

>MRAB, Peter: thanks for the decorator idea!


As an afterthought, is there any way to extend this general idea
to other docstrings beyond function docstrings?

I imagine that the decorator idea works well for method docstrings
too (though I have not tried any of this yet).

But, IIRC, decorators don't work for classes, so class docstrings
would need to be expanded expressly.

The hardest case is "module docstrings".  In particular, the
docstring for a script.  Is there any way to apply the globals
expansion idea to a script's toplevel docstring?

(I imagine the answer to this last question is "no", but I thought
I'd ask. :) )

~kj






More information about the Python-list mailing list