docstrings for data fields

  • Thread starter Ulrich Eckhardt
  • Start date
U

Ulrich Eckhardt

Hi!

My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with
functions I would simply add a docstring explaining the meaning of this,
but how do I do that for a non-function member? Note also that ideally,
this constant wouldn't show up inside instances of the class but only
inside the class itself.

There are decorators for static functions or class functions, similarly
there is one for instance properties but there isn't one for class
properties. Would that be a useful addition?

Uli
 
M

mblume

Am Thu, 03 May 2012 14:51:54 +0200 schrieb Ulrich Eckhardt:
Hi!

My class Foo exports a constant, accessible as Foo.MAX_VALUE. Now, with
functions I would simply add a docstring explaining the meaning of this,
but how do I do that for a non-function member? Note also that ideally,
this constant wouldn't show up inside instances of the class but only
inside the class itself.

There are decorators for static functions or class functions, similarly
there is one for instance properties but there isn't one for class
properties. Would that be a useful addition?

Uli

Docstring for Foo?

.... """ exports a FOO_MAX value """
.... FOO_MAX = 42
....Help on class Foo in module __main__:

class Foo
| exports a FOO_MAX value
|
| Data and other attributes defined here:
|
| FOO_MAX = 42


HTH
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top