K
km
Hi all,
i create a class as below :
#!/usr/bin/python -W
class Point:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __str__(self):
print '(' + str(self.x) + str(self.y) + ')'
def __add__(self,other):
return Point(self.x + other.x, self.y + other.y)
but it emits an indendation error -- i tried to fix it but in vain --
and the error message was :
File "script.py", line 6
self.x = x
^
IndentationError: expected an indented block
kindly enlighten hwo to fix this --
it will be great if someone can direct me to an online link regarding the rules of indendation.
thanks,
KM
i create a class as below :
#!/usr/bin/python -W
class Point:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __str__(self):
print '(' + str(self.x) + str(self.y) + ')'
def __add__(self,other):
return Point(self.x + other.x, self.y + other.y)
but it emits an indendation error -- i tried to fix it but in vain --
and the error message was :
File "script.py", line 6
self.x = x
^
IndentationError: expected an indented block
kindly enlighten hwo to fix this --
it will be great if someone can direct me to an online link regarding the rules of indendation.
thanks,
KM