As what I just learned, I can use super()
this way:
super(class, obj_of_class-or-_subclass_of_class)
Code goes below:
From the Python release notes on overriding the __new__
method:
__new__
is a static method, not a class method. I initially thought it would have to be a class method, and that's why I added the classmethod primitive. Unfortunately, with class methods, upcalls don't work right in this case, so I had to make it a static method with an explicit class as its first argument.
Since __new__
is a static method, super(...).__new__
returns a static method. There is no binding of cls
to the first argument in this case. All arguments need to be supplied explicitly.