I would like to create a circle class with three parameters (radius, coordinate x and y).
class circle:
def __init__(self, r, x, y):
self.radius = r
self.X = x
self.Y = y
Calling it requires 3 arguments(radius, x and y). Apart from taking 3 arguments like normal, how do I make it to be able to take 1 argument(the radius) and take 2 arguments(coordinate x and coordinate y) at the same time?
For instances, the class can take all of these at the same time:
uk = circle(4, 5, 6) #(r, x, y)
uj = circle(1, 2) #(x, y)
uh = circle(8) #(r)
Could it be dealt with multiple constructors(overloading, classmethod)?