>> 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
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/