[Python-ideas] Keyword for direct pass through of kwargs to super

Michael Lohmann mial.lohmann at gmail.com
Mon May 28 03:27:24 EDT 2018


>>    class Magic:
>>        magic_number = 42
>>        def __init__(self):
>>            A.magic_number = 0  # As soon as you look too deep into it all the Magic vanishes
> 
> What is A here? Did you mean something else?

Sorry for that. Yes, it should have been Magic (I renamed the class after writing it and didn’t pay attention). I just wanted to override the class-variable `magic_number` to give a reason why I don’t ever want to call Magic.__init__ in Foo. If you want, you can have this class instead:

    class Magic:
        def __init__(self):
            raise RuntimeError("Do not initialize this class")

but I figured that this might look a bit artificial...


More information about the Python-ideas mailing list