Python empty constructor

Narek Tarasyan picture Narek Tarasyan · Mar 19, 2017 · Viewed 53.9k times · Source

Is there any way to create an empty constructor in python. I have a class:

class Point:
    def __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z

now I initialize it like this:

p = Point(0, 5, 10)

How can I create an empty constructor and initialize it like this:

p = Point()

Answer

Waxrat picture Waxrat · Mar 19, 2017
class Point:
    def __init__(self):
        pass