Docstrings for class attributes
Peter Pearson
ppearson at nowhere.invalid
Tue Sep 23 11:14:18 EDT 2008
On Tue, 23 Sep 2008 15:23:35 +1000, Tom Harris <celephicus at gmail.com> wrote:
>
> I want to have a class as a container for a bunch of symbolic names
> for integers, eg:
>
> class Constants:
> FOO = 1
> BAR = 2
>
> Except that I would like to attach a docstring text to the constants,
> so that help(Constants.FOO) will print some arbitrary string.
[snip]
Commiserating, not helping: I have a similar problem with a module
that holds values of physical constants,
http://webpages.charter.net/curryfans/peter/nature.py:
boltzmanns_constant = 1.380622e-16 * erg / k
stefan_boltzmann_constant = 5.66961e-5 * erg/s/cm/cm/k/k/k/k
gravitational_constant = 6.6732e-8 * erg*cm/g/g
I would like to reveal more details with, e.g.,
help( gravitational_constant ) . . . and maybe then I could
use shorter names.
--
To email me, substitute nowhere->spamcop, invalid->net.
More information about the Python-list
mailing list