[Python-3000] abc docs

Mark Summerfield mark at qtrac.eu
Wed Sep 5 10:43:04 CEST 2007


On 2007-09-04, Georg Brandl wrote:
> I've added a basic skeleton of documentation for the "abc" module, but it
> would be nice if somebody proofread it and at add more from PEP 3119 if
> desired.

One strange point: the module correctly appears on the
library/python.html page (Python Runtime Services), but does _not_
appear in library/index.html (The Python Standard Library), although all
the other Python Runtime Services modules do. index.rst lists python.rst
and python.rst lists abc.rst.

I've done various changes to the text, with one semantic change (in the
parenthesised phrase about __mro__).

Also, I added a table to collections.rst listing collections.Container,
collections.Hashable, and similar that you might want to check over.

All in revision 57988.


BTW When I tried a variation of one of the ABC examples from the PEP I
got this:

    Python 3.0a1 (py3k, Sep  1 2007, 08:25:11)
    [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import abc
    >>> class MyABC(abc.ABCMeta): pass
    ...
    >>> MyABC.register(tuple)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    RuntimeError: maximum recursion depth exceeded in __instancecheck__

So then I tried it exactly as written, and it worked fine:

    Python 3.0a1 (py3k, Sep  1 2007, 08:25:11)
    [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from abc import ABCMeta
    >>> class MyABC(metaclass=ABCMeta): pass
    ...
    >>> MyABC.register(tuple)
    >>> assert issubclass(tuple, MyABC)
    >>> assert isinstance((), MyABC)

I hope that the first one is a bug rather than intended.

-- 
Mark Summerfield, Qtrac Ltd., www.qtrac.eu



More information about the Python-3000 mailing list