Error saying "TypeError: descriptor object needs an argument"

0 votes

I have this python code:

class A:
    def __init__(self, name):
        self.name = name

class B(A):
    def __init__(self):
        super.__init__()

And I get the following error:

TypeError
Traceback (most recent call last)
<ipython-input-7-ea9745abfeb2> in <module>()
----> 1 C = B()

<ipython-input-4-2d2ef2cc5406> in __init__(self)
  5 class B(A):
  6   def __init__(self):
----> 7     super.__init__()

TypeError: descriptor '__init__' of 'super' object needs an argument
May 28 in Python by Vishal
121 views

1 answer to this question.

0 votes

The error is pretty straight forward, toy need to pass an argument to the function super()

class A:
    def __init__(self, name):
        self.name = name

class B(A):
    def __init__(self, name):
        super().__init__(name)
answered May 28 by Alisha

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Python error "TypeError: range() integer end argument expected, got numpy.float64."

Hi @Kashish, try something like this: for i ...READ MORE

answered May 27 in Python by Harish
47 views
0 votes
1 answer

Error saying "ValueError: Invalid file object: <_io.BufferedReader name=9>"

Once you've executed the following command, your ...READ MORE

answered May 28 in Python by Tamanna
55 views
0 votes
1 answer

Python error "TypeError: Can't convert 'int' object to str implicitly"

Hey Yamini, you cannot concatenate a string ...READ MORE

answered May 31 in Python by Gargi
142 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 173 views
+4 votes
6 answers
0 votes
1 answer
0 votes
1 answer

How can I print an Error in Python?

For Python 2.6 and later and Python ...READ MORE

answered Oct 12, 2018 in Python by ariaholic
• 7,340 points
31 views