How to create a docstring for a module?

Stefan Behnel stefan_ml at behnel.de
Sun Dec 6 16:08:08 EST 2009


Dr. Phillip M. Feldman, 06.12.2009 21:34:
> OK.  I was able to reproduce the problem.  My difficulty was that the command
> that I issued initially was "from xyz import *" rather than just "import
> xyz".  If I say "import xyz", then the docstring is defined; if I say "from
> xyz import *", it isn't.  I'm not sure whether this is a bug or expected
> behavior.

Definitely expected behaviour.

The problem isn't the docstring but what you import. "from xyz import
a,b,c" does not import "xyz" into the current namespace. Only the names
a,b,c are imported. If you do "import xyz", then "xyz" becomes a defined
name in your current namespace.

Stefan



More information about the Python-list mailing list