[Python-3000] Generic function PEP won't make it in time
Guido van Rossum
guido at python.org
Wed Apr 25 02:01:10 CEST 2007
On 4/24/07, Bill Janssen <janssen at parc.com> wrote:
> Just to chime in...
> My preference would be to have "abstract" just mark classes that
> define an API, that define the "abstraction" of that particular
> interface. Not carry over meanings from Java and C++ that "abstract"
> somehow always means "partial" or "incomplete". I'd envision having
> "abstract" classes that are in fact also useful and complete
> implementations. "Abstract" methods don't really make sense (to me)
> in Python. This sounds very close to what Guido has already.
> Maybe "abstraction" is a better keyword than "abstract".
> Maybe it makes sense to have "abstraction" classes, and an
> "@ignorethismethod" decorator to mark methods that are *not* part of
> the abstraction, instead of "@abstractmethod" decorators to mark the
> methods that *are* part of the abstraction.
Hm, but sometimes characteristic methods are abstract, and in other
cases they are concrete. For exampe:
def __iter__(self): # This is abstract in Iterable, but concrete here
Both methods are part of the ABC. But only __next__ is abstract. Once
could define a perfectly valid empty iterator like this:
return super(EmptyIterator, self).__next__()
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000