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, 2019 in Python by Vishal
4,023 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, 2019 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, 2019 in Python by Harish
774 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, 2019 in Python by Tamanna
1,521 views
0 votes
2 answers

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

A TypeError can occur if the type ...READ MORE

answered Feb 5 in Python by lovelmark
• 160 points
1 flag 3,277 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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,373 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,014 views
0 votes
1 answer

Error saying "TypeError: range() integer end argument expected"

Try this: [x * 0.01 for x in ...READ MORE

answered May 27, 2019 in Python by Keshav
358 views
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 aryya
• 7,380 points
261 views