Help with super()
Paul McNett
p at ulmcnett.com
Thu Jan 12 20:15:19 EST 2006
David Hirschfield wrote:
> So, the larger question is how to do anything that resembles what I
> want, which is to have a chain of subclasses with a single attribute
> that each subclass can define as it wishes to, but with the ability to
> get the combined value from all the ancestors down to the current
> subclass I access that attribute from.
>
> Does that make any sense?
Yes, it makes sense. The trick is to not query the values using self, but to ask
the class definitions for the attribute. See my second message that gives an
example, climbing the __mro__ tree backwards.
--
Paul McNett
http://paulmcnett.com
http://dabodev.com
More information about the Python-list
mailing list