R. David Murray
rdmurray at twirl.bitdance.com
Mon Jul 23 16:46:35 CEST 2001
Erik Max Francis <max at alcyone.com> writes:
>Sheila King wrote:
>> That's because the "big picture" is the general overview of how the
>> parent class works.
>The behavior of the parent class is as the library reference states: It
>implements __str__, __getitem__, __len__ (presumably), and args.
>Exception is just a class like everything else; other than having the
>behavior as specified in the reference, it's your typical class.
I agree with Sheila here: while I *can* subclass and develop based
solely on the the documentation, I have a much greater comfort level
when I can actually look at the *implementation* of the base class.
I realize that the goal of encapsulation is to make this unnecessary,
but I'm talking here as much about psychological comfort as anything
that affects my knowledge level. It probably does have an effect on
my productivity, though.
Still, I've been able to happily subclass from dictionary and list
(through UserDict and UserList) without caring how they are
implemented internally, so it's really just a personal nit and
not something anyone else should care about.
There is, however, a deeper sense in which pointing Shelia or myself
to the documentation in the Library Reference is *not* an adequate
answer to "this is what you need in order to subclass", and it not
merely a matter of providing some examples (though that certainly
helps a lot!). What the Library Reference lacks, at least with
regards to the built in types, is a single, comprehensive, and
concise list of *all* of the methods that a type implements, and
their semantics. In other words, the *complete* Interface of the
type; some way to answer the question: what is the expected behavior
of a class that is going to play the same role as this thing I am
subclassing? Right now I get that information (very effectively!)
out of files like exceptions.py and UserList.py. But we've lost
exceptions.py already, and we will soon lose UserList.py and its
I've looked at the Interfaces module (from Zope), and that could
form the basis of something that could auto-generate the answer to
this question. (It might not be enough by itself, though, because
I might still need documentation that would let me know which
combination of underlying Interfaces implemented by a class were
essential to the particular role that I am expecting my subclass
More information about the Python-list