Can this code
class Point:
def __init__(self,x,y):
self.x=x
self.y=y
def __str__(self):
return "Point({},{})".format(self.x,self.y)
p=Point(3,5)
print(p)
be modified to following code?
class Point:
def __init__(p,x,y):
p.x=x
p.y=y
def __str__(p):
return "Point({},{})".format(p.x, p.y)
p=Point(3,5)
print(p)
It seems to be worked in this case. But it is so naive case. I wonder using other than 'self' will cause some problem in some situations.