This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger
Date 2012-09-25.23:20:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Since inheritance is more commonplace and more easily understood than __metaclass__, the abc module would benefit from a simple helper class:

    class ABC(metaclass=ABCMeta):

From a user's point-of-view, writing an abstract base call becomes simpler and clearer:

    from abc import ABC, abstractmethod

    class Vector(ABC):

        def __iter__(self):

        def dot(self, other):
            'Compute a dot product'
            return sum(map(operator.mul, self, other))

Notice that this class seems less mysterious because it inherits from ABC rather than using __metaclass__=ABCMeta.

Also note, it has become a reasonably common practice for metaclass writers to put the __metaclass__ assignment in a class and have it get inherited rather than requiring users do the metaclass assignment themselves.
Date User Action Args
2012-09-25 23:20:31rhettingersetrecipients: + rhettinger
2012-09-25 23:20:31rhettingersetmessageid: <>
2012-09-25 23:20:10rhettingerlinkissue16049 messages
2012-09-25 23:20:09rhettingercreate