[Python-Dev] PEP 246 - Object Adaptation
Guido van Rossum
guido@python.org
Mon, 15 Jul 2002 10:04:54 -0400
(Changing the subject)
> The big question is rather: given that Isub inherits from Isuper,
> does any object implementing Isub also implicitly implement Isuper?
This probably shows my naivete more than anything else...
I'd say "of course", based on an example where Isuper is
FileOpenForReading and Isub is FileOpenForReadingAndWriting.
It would be strange if a file open for reading and writing was not
acceptable in a place where a file open for reading is accepted
(because it implements all the right methods). Or is the fact that it
implements *more* the problem?
Am I missing something?
I also thought that there's a different dimension of interface
inheritance: if class C implements interface I, and class D derives
from class C, does D implicitly implement I also? Again, I'd say
yes. But I believe Jim Fulton disagrees with me. And again, I
haven't tried to use interfaces enough to understand what problems you
could get into by this assumption.
--Guido van Rossum (home page: http://www.python.org/~guido/)