indendation error

km km at mrna.tn.nic.in
Fri Dec 26 07:15:43 CET 2003


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






More information about the Python-list mailing list