On Fri, 2002-01-18 at 14:36, Tavis Rudd wrote:
> > I feel like there's been proposals for adding doc strings to
> > attributes...? Ah... it's PEP 224, which has been rejected. Guido
> > proposed using a convention like:
> >
> > class Whatever
> > a = 10
> > __doc_a__ = 'a is used for whatever'
>
>
> But then what about docstring processing tools like pydoc?
Without any standard for attribute doc strings, no, pydoc wouldn't
work. It seems like it would be very easy to add, though.
> > Usually I'd just summarize all the attributes in the class doc
> > string. It's easier to read anyway, though it can't be
> > automatically extracted.
>
> That works, but its not as clean as the current approach. And it
> increases the chances of the docstring being out of date.
I don't think so, because plain attributes will usually be best defined
in __init__, which is usually right next to the class docstring. The
style:
class Whatever:
a = 10
is something I almost never use, except for a few boring constants. I
usually do:
class Whatever:
def __init__(self):
a = some derived value
Putting it in the class docstring is as good a place as I can think of.
Ian
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss