Abbreviations: Q uestion -- P roblem -- S olution
Q: I follow your recommendation to call
super().__init__(dom, ran)
in the__init__()
method of myMyOperator
, but I get the following error:File <...>, line ..., in __init__ super().__init__(dom, ran) TypeError: super() takes at least 1 argument (0 given)
P: The
super()
function in Python 2 has to be called with a type as first argument, whereas in Python 3, the type argument is optional and usually not needed.S: We recommend to include
from builtins import super
in your module to backport the new Py3super()
function. This way, your code will run in both Python 2 and 3.