python's OOP question

neoedmund neoedmund at gmail.com
Mon Oct 16 05:33:59 EDT 2006


Bruno Desthuilliers wrote:
> neoedmund wrote:
> (*PLEASE* stop top-posting - corrected)
> >
> > Ben Finney wrote:
> >> [Please don't top-post above the text to which you're replying.]
> >>
> >> "neoedmund" <neoedmund at gmail.com> writes:
> >>
> >>> I'm trying to achieve a higher level of "reusability". Maybe it
> >>> cannot be done in python? Can anybody help me?
> >> What, specifically, are you trying to achieve? What problem needs
> >> solving?
>
> > python use multiple inheritance.
> > but "inheritance" means you must inherite all methods from super type.
> > now i just need "some" methods from one type and "some" methods from
> > other types, to build the new type.
> > Do you think this way is more flexible than tranditional inheritance?
>
> While dynamically adding attributes (and methods - which are attributes
> too) is not a problem, I'd second Gregor's anwser : it might be better
> to use composition/delegation here.
>

Could you show some code to help me know how composition/delegation can
be done here? Thanks.




More information about the Python-list mailing list