By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,592 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,592 IT Pros & Developers. It's quick & easy.

is it "legal" to pace the module's doc string after some imports?

P: n/a
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
"""

thanks,
Stef Mientki

Oct 26 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Oct 26 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.