471,330 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

properties give variable docstrings

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....cd7551d8?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....
Dec 13 '07 #1
0 915

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sridhar R | last post: by
reply views Thread by Craig Ringer | last post: by
2 posts views Thread by Steven Bethard | last post: by
reply views Thread by Michael Muller | last post: by
6 posts views Thread by Kamilche | last post: by
45 posts views Thread by Brett | last post: by
11 posts views Thread by Brent Ritchie | last post: by
6 posts views Thread by Steve Brown | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.