On Sun, 26 Oct 2008 02:31:01 +0200, Stef Mientki wrote:

> hello,
> 
> I wonder if it's  "legal" to pace the module's doc string after some
> imports ?
> 
> I mean something like this:
> 
> from language_support import _
> __doc__ = _(0, """
> some documentation
> """


Doc strings are normal objects like anything else, so the above should 
work fine.

The only "magic" that happens with doc strings is that if you have a bare 
string immediately after a class, method or function definition, or at 
the top of the module, it gets picked up by the compiler and assigned to 
__doc__. You can do anything you like to it.


You might even do this:

# top of module
"""This is some 
documentation
blah blah blah
"""

try:
    from language_support import _
    __doc__ = _(0, __doc__)
except ImportError:
    pass


and it should just work. 


-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to