[Python-ideas] Keyword for direct pass through of kwargs to super
Jacco van Dorp
j.van.dorp at deonet.nl
Mon May 28 03:31:54 EDT 2018
I'd say NOT wanting to call an __init__ method of a superclass is a
rather uncommon occurence. It's generally a huge error. So I think
it's worth not accomodating that.
2018-05-28 9:27 GMT+02:00 Michael Lohmann <mial.lohmann at gmail.com>:
>>> 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...
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
More information about the Python-ideas