python's OOP question
onurb at xiludom.gro
Mon Oct 16 11:23:52 CEST 2006
(*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
> 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.
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