Docstrings for attributes?

R

Roy Smith

Is there any way to attach a docstring to an attribute? I see that PEP-257
talks about attribute docstrings, but it references PDP-258, which was
rejected.

I suppose I could eschew plain attributes in favor of getter functions,
because those give me a place to hang a docstring, but that feels like the
wrong thing to do.
 
A

alex23

Is there any way to attach a docstring to an attribute?  I see that PEP-257
talks about attribute docstrings, but it references PDP-258, which was
rejected.

I suppose I could eschew plain attributes in favor of getter functions,
because those give me a place to hang a docstring, but that feels like the
wrong thing to do.

There were a couple of solutions provided - including the use of
properties - when this question came up earlier this week:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/18a8c3f09ac02f85#
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top