Python empty constructor Python empty constructor python python

Python empty constructor


class Point:    def __init__(self):        pass


As @jonrsharpe said in comments, you can use the default arguments.

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

Now you can call Point()


You can achieve your desired results by constructing the class in a slightly different manner.

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