[Python-3000] PEP 3119 - Introducing Abstract Base Classes
janssen at parc.com
Fri Apr 27 19:40:02 CEST 2007
Jim Jewett wrote:
> On 4/27/07, Barry Warsaw <barry at python.org> wrote:
> > - - Attributes. Interfaces allow you to make assertions about
> > attributes, not just methods, while ABCs necessarily cover only methods.
> Why can't they have data attributes as well?
I agree with Jim. It seems to me that documenting standard attributes
of a type is one thing that ABC's should be able to do. Perhaps a
"@abstractattribute" decorator of some sort? Perhaps a class decorator
"@attributes(name1, name2, ...)"? Attributes with those names would be
automatically added to an instance, initialized to None, before the
first __init__ method would be called.
More information about the Python-3000