TypeError: super() takes at least 1 argument [Python 3]
Question: In the following codes, I kept on getting the same error although I rechecked
it for more than 15 minutes. For your info, I ran it on sublime text and the
error:

> TypeError: super() takes at least 1 argument (0 given)

The code is as shown below:

    
    
    class Car():
    """A simple attempt to represent a car."""
    
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0
    
    def get_descriptive_name(self):
        long_name = str(self.year) + ' ' + self.make + ' ' + self.model
        return long_name.title()
    
    def read_odometer(self):
        print("This car has " + str(self.odometer_reading) + " miles on it.")
    
    def update_odometer(self, mileage):
        if mileage >= self.odometer_reading:
            self.odometer_reading = mileage
        else:
            print("You can't roll back an odometer!")
    
    def increment_odometer(self, miles):
        self.odometer_reading += miles
    
    class ElectricCar(Car):
        """Represent aspects of a car, specific to electric vehicles."""
    
        def __init__(self, make, model, year):
            """Initialize attributes of the parent class."""
            super().__init__(make, model, year)
    
    my_tesla = ElectricCar('tesla', 'model s', 2016)
    print(my_tesla.get_descriptive_name())
    


Answer: The problem here is a fairly [well
documented](http://stackoverflow.com/questions/576169/understanding-python-
super-with-init-methods?noredirect=1&lq=1) one on StackOverflow. But I'll
explain how you are using `super()` incorrectly. You're using what's called
[Old Style classes](https://wiki.python.org/moin/NewClassVsClassicClass),
while trying to use `super()`. **New style classes** inherit from
[`object`](https://docs.python.org/2/library/functions.html#object) and can be
used in **Python 2.2** and up (_Python 3 exclusively uses New style classes_).

Your `Car` class declaration should look like this -> `class Car(object):`
(`Car` _inherits from the_ `object` _built-in_), with your `super` call having
the class the object is in, and `self` passed in as arguments:

    
    
    super(ElectricCar, self).__init__(make, model, year)
    

Now, if we _print_ out the type of object `my_tesla` is:

    
    
    >>> print type(my_tesla)
    <class '__main__.ElectricCar'>    
    

We can see it's of type `ElectricCar`.

Now why is all this important? Well there are a few key differences between
the styles. In the Old style, the class and the objects it defines for
instantiating are of _different_ types. In Old style classes, instances are
always of type `instance`, regardless of their class. With New style classes,
an instance is generally going to share the same type that it's class has.
Examples:

**Old Style** ->

    
    
    >>> class MyClass:
        pass
    >>> print type(MyClass)
    >>> print type(MyClass())
    <type 'classobj'>
    <type 'instance'>
    

**New Style** ->

    
    
    >>> class MyClass(object):
        pass
    >>> print type(MyClass)
    >>> print type(MyClass())
    <type 'type'>
    <class '__main__.MyClass'>
    

Please refer to Python's official documentation on
[`super()`](https://docs.python.org/2/library/functions.html#super).

