[Python-Dev] Re: [PEP 224] Attribute Docstrings

Aahz Maruch aahz at netcom.com
Mon Aug 28 14:03:02 EDT 2000


[p&e]

In article <39AAA306.2CBD5383 at lemburg.com>,
M.-A. Lemburg <mal at lemburg.com> wrote:
>
>class A:
>    " Base class for database "
>
>    x = "???"
>    " name of the database; override in subclasses ! "
>
>    y = 1
>    " run in auto-commit ? "
>
>class D(A):
>
>    x = "mydb"
>    """ name of the attached database; note that this must support
>        transactions 
>    """
>
>This will give you:
>
>A.__doc__x__ == " name of the database; override in subclasses ! "
>A.__doc__y__ == " run in auto-commit ? "
>D.__doc__x__ == """ name of the attached database; note that this must support
>        transactions 
>    """
>D.__doc__y__ == " run in auto-commit ? "
>
>There's no way you are going to achieve this using dictionaries.

Maybe I'm dense, but what about

A.__docs__['x'] == " name of the database; override in subclasses ! "
A.__docs__['y'] == " run in auto-commit ? "
D.__docs__['x'] == """ name of the attached database; note that this must support
        transactions 
    """
D.__docs__['y'] == " run in auto-commit ? "

If D.__doc_y__ or D.__docs__['y'] is a reference to A.__docs__['y'],
then it's a reference either way.  Conversely, if it's *not* a
reference, there's *definitely* no problem.
--
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Usenet is not a democracy.  It is a weird cross between an anarchy 
and a dictatorship.  --Aahz



More information about the Python-list mailing list