Composition instead of inheritance
Ethan Furman
ethan at stoneleaf.us
Fri Apr 29 18:22:53 EDT 2011
Ian Kelly wrote:
> On Thu, Apr 28, 2011 at 11:15 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>> For anybody interested in composition instead of multiple inheritance, I
>> have posted this recipe on ActiveState (for python 2.6/7, not 3.x):
>>
>> http://code.activestate.com/recipes/577658-composition-of-classes-instead-of-multiple-inherit/
>>
>> Comments welcome!
>
> On line 14, is it intentional that attributes whose values happen to
> be false are not considered as conflicts?
Nope, not intentional at all! I'll fix that...
> On line 31, this code:
>
> thing = getattr(thing, '__func__', None) or thing
>
> could be simplified to this:
>
> thing = getattr(thing, '__func__', thing)
I'll fix that, too.
Thanks!
More information about the Python-list
mailing list