[PEP 224] Attribute Docstrings

Piet van Oostrum piet at cs.uu.nl
Sun Aug 27 14:14:12 EDT 2000


>>>>> Frank Niessink <frankn=nuws at cs.vu.nl> (FN) writes:

FN> M.-A. Lemburg <mal at lemburg.com> wrote:
>> Even though the implementation won't go into Python 2.0, it

FN> [snip]

>> The following name mangling scheme achieves all of the above:
>> __doc__<attributename>__


FN> It is my understanding that in the long run, every object in Python
FN> will become a 'real' object. If that is the case, wouldn't the naming
FN> scheme <attributename>.__doc__ be a better one?

FN> So if:

FN> class C:
FN>   a = 1
FN>   """Description of a."""

FN> then:

FN> C.a.__doc__ == "Description of a."

No, that wouldn't work, as C.a == 1, so C.a.__doc__ == 1.__doc__.
But you are not interested in the meaning of 1, but in the attribute a of
class C, no matter what its current value is.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list