python's OOP question

Bruno Desthuilliers onurb at xiludom.gro
Mon Oct 16 05:23:52 EDT 2006


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.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list