Accessing parent objects

Chris Angelico rosuav at gmail.com
Sat Mar 24 22:28:40 EDT 2018


On Sun, Mar 25, 2018 at 1:20 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> On Saturday, March 24, 2018 at 6:57:29 PM UTC-5, Steven D'Aprano wrote:
>> There's nothing wrong with super() in Python 2. You just
>> have to understand what you're doing. It's still the right
>> solution for doing inheritance the right way.
>
> The problem is, Python's super is not intuitive.
>
> And i'd like to use it. I really would! Because, yes, you
> are correct when you say: "super is the proper way to do
> inherence". But for some reason, i just cannot get it to
> work reliably.
>
> And reading the docs doesn't help.
>
> Seriously, i find it difficult to believe no one else has
> been stumped by Python's super. I have used super in other
> languages with no issues -- everything is intuitive -- but
> in Python, my favorite language, forget about it.
>
> So now, i've got all this Python code with explicit
> inheritance, and it works, but it just feels ugly.

So tell me, how do these other (beautifully intuitive) languages
handle multiple inheritance? I'm sure it's really easy to make super()
work when there's exactly one superclass that you can lock in at
compile time.

ChrisA



More information about the Python-list mailing list