Syntax Error?


My code gave the error message:
File "python", line 2
init(self, x, y, z):
SyntaxError: invalid syntax

It's not showing it in the pasted error message, but the init does have the underscores around it, and the "^" is pointing to the colon. Couldn't find anything on Stack Overflow, so I came here and posted it.

class Point3D(object):
    __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z
        return "(%d, %d, %d)" % (self.x, self.y, self.z)
my_point = Point3D(1, 2, 3)
print my_point


The error is before __init__. What does that tell you? See anything missing?


Yes. This was definitely the worst forum question I've ever asked. Thank you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.