git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plumbing behind super()


On Thursday, June 27, 2019 at 8:30:21 PM UTC-5, DL Neil wrote:
> I'm mystified by "literally given nothing".

I'm focusing there particularly on the syntax of writing "super()" without any arguments to it. However, internally it's getting fed stuff.

> If a class has not defined an attribute, eg self.my_attribute, but the 
> base class has defined an attribute of that name, then self.my_attribute 
> will as initialised by the base class. Welcome to the intricacies of 
> managing scope!

I'm thinking my problem was more fundamental here. I finally got the debugger to bypass all the calls to the internal super() implementation that are done on startup and run instead just a bit of user-specified code. It's looking like super() actually gobbles the self pointer that goes on to the stack when __init__ is first created and replaces it when its done by returning it again. I think. Maybe.