Closed
Description
Environment data
VS Code version: 1.20.0
Python Extension version: 2018.1 (01 Feb 2018)
Python Version: 3.6.2
OS and version: Windows 10 Pro 64-bit
Workspace Settings:
{ "python.pythonPath": "C:\\Program Files\\Python36\\python.exe" }
Actual behavior
VS Code doesn't seem to recognise super() correctly when using Python 3:
class Animal(object):
def __init__(self, name):
self.name = name
def sayHello(self, breed=None):
if breed:
print("hello i am {} and I am a {}".format(self.name, breed))
else:
print("hello i am {}".format(self.name))
class Cat(Animal):
def __init__(self, Cat_name):
super().__init__(Cat_name)
# Animal.__init__(self, Cat_name)
self._breed = None
Max = Cat("Max")
gives me an error. If I change it to super(Cat, self).__init__(Cat_name)
I get my expected result of no error.
Expected behavior
Steps to reproduce:
- Copy code above into VS Code
Logs
Output from Python
output panel
Traceback (most recent call last):
File "c:\Users\watenatj\OneDrive\Work - Python\OOP\Inheritance 112817.py", line 42, in <module>
main()
File "c:\Users\watenatj\OneDrive\Work - Python\OOP\Inheritance 112817.py", line 33, in main
Max = Cat("Max")
File "c:\Users\watenatj\OneDrive\Work - Python\OOP\Inheritance 112817.py", line 16, in __init__
super().__init__(Cat_name)
TypeError: super() takes at least 1 argument (0 given)