[docs] [issue19054] Descriptors howto

Marco Buttu report at bugs.python.org
Sat Sep 21 12:44:26 CEST 2013

Marco Buttu added the comment:

I think the indentation is a problem, for several reasons. In all the examples in the documentation, the form by using the interactive shell is the following:

    >>> class MyClass:
    ...     pass


    class MyClass:

This one is awful:

>>> class MyClass:

and in fact it is no used in the doc. So if you want to put the class clause in the interactive shell, you have to add the dots to indent the suite of the compound statement, in order to be consistent with the rest of all the documentation.
But it is not just a problem of beauty:

$ python -m doctest descriptor.rst 
File "descriptor.rst", line 165, in descriptor.rst
Failed example:
    class MyClass(object):
Exception raised:
        class MyClass(object):
    SyntaxError: unexpected EOF while parsing

By applying the patch, the definitions of the classes RevealAccess and MyClass pass the documentation test. The whole example does not pass in any case, because you are not consistent using the shell notation.

Added file: http://bugs.python.org/file31833/py3howto.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list