Class hierarchy problem

Chris Angelico rosuav at gmail.com
Tue Aug 6 13:12:36 EDT 2013


On Tue, Aug 6, 2013 at 4:36 PM, BrJohan <brjohan at gmail.com> wrote:
> Consider a botanical classification system (somewhat analogous to my
> 'problem' as it effectively is related to classification of entities):
>
> A Domain should know about its Kingdoms,
> a Kingdom should know about its Phylums,
> ...
> a Genus should know about its Species.

I don't believe it's that clear. In some situations it may be best to
work that way; in others, each tier should know only those above it.
Does the generic Widget know about being a PushButton, a ListBox, and
a Slider? No, but the Slider knows what a Widget is.

ChrisA



More information about the Python-list mailing list