I am new to python. Im trying to access the parent class variable in child class using super() method but it throws error "no arguments". Accessing class variable using class name works but i like to know whether it is possible to access them using super() method.
class Parent(object):
__props__ = (
('a', str, 'a var'),
('b', int, 'b var')
)
def __init__(self):
self.test = 'foo'
class Child(Parent):
__props__ = super().__props__ + (
('c', str, 'foo'),
) # Parent.__props__
def __init__(self):
super().__init__()
Error:
__props__ = super().__props__ + (
RuntimeError: super(): no arguments
super()is something you call in an instance method, not at class level. And you shouldn't define your own double-underscore attributes anyway.objectso you can simply removeobject; in regards to the issue; you're trying to usesuper()in a class top level definition; which can't be done.