properties give variable docstrings

T

tjhnson

The topic of docstrings for variables has come up many times before.
In fact, a PEP was proposed and rejected on this very topic.

http://www.python.org/dev/peps/pep-0224/

When creating classes, I like using properties...and I like even more
that these properties have docstrings. This allows one to
interactively explore the API and understand (in a limited sense) what
the variables mean in the context of the class. I am in a situation
where I need to add a large number of properties to a class (the
properties are almost identical...differing only by a docstring)...

The topic of dynamically generating properties has been discussed
here:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/3d682513cd7551d8?hl=en

The conclusion there seems to suggest that I'd probably be better off
using __getattr__. This makes sense, but the downside is that I no
longer have docstrings for my attributes.

So, I'm wondering what others think...is it worthwhile to define
properties just so that I can have docstrings for attributes? Or is
creating a bunch of properties overkill in every possible way....
 

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

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,224
Latest member
BettieToom

Latest Threads

Top