Stylistic question about inheritance

Carl Banks invalidemail at aerojockey.com
Thu Mar 31 22:15:27 CEST 2005


Andrew Koenig wrote:
[snip]
> Of course, there are reasons to have a base class anyway.  For
example, I
> might want it so that type queries such as isinstance(foo, Expr)
work.  My
> question is: Are there other reasons to create a base class when I
don't
> really need it right now?

Well, Python seems to get along fine without the ability to do
isinstance(foo,file_like_object); probably better off in the end for
it.  So I'd say you should generally not do it.  Inheritence is for
when different classes need to share functionality.


-- 
CARL BANKS




More information about the Python-list mailing list