Python - AttributeError
<p>So for a line class I'm doing, I keep getting an error that says</p>

<pre><code>AttributeError: Line instance has no attribute 'point0'
</code></pre>

<p>I'm declaring the line like this:</p>

<pre><code>def __init__(self, point0, point1):
    self.x = point0
    self.y = point1

def __str__(self):
    return '%d %d' % (int(round(self.point0)), int(round(self.point1)))
</code></pre>

<p>And I get the x and y from my point class which should already be float values so I don't need to check for an error in my init method however I do check to see if point0 and point1 are floats in my rotate method:</p>

<pre><code>def rotate(self, a):
        if not isinstance(a, float) or not isinstance(self.point0, float) or not isinstance(self.point1, float):
            raise Error("Parameter \"a\" illegal.")
        self.point0 = math.cos(a) * self.point0 - math.sin(a) * self.point1
        self.point1 = math.sin(a) * self.point0 + math.cos(a) * self.point1
</code></pre>

<p>So why does python keep saying that it has no attribute point0? I also tried changing my <em>init</em> method to look like this:</p>

<pre><code>def __init__(self, point0, point1):
    self.point0 = point0
    self.point1 = point1
</code></pre>

<p>But when I do that the error says point0 has no attribute float. So why do I keep getting this error? Here's the code I'm using to test:</p>

<pre><code>p0 = Point(0.0, 1.0)
p1 = Point(2.0, 3.0)
line = Line(p0,p1)
print line
</code></pre>