How to declare a member of 'list' in a class?
<p>I'm new to python, and it really confused me.</p>

<p>I want to write something like  </p>

<pre><code>class line :
    points = []

    def add(self, point) :
        self.points.append(point)

line1 = line()
line2 = line()
line1.add("Some point")
print line2.points
</code></pre>

<p>Output: <code>['Some point']</code></p>

<p>And the result is like they refers to the same list.<br>
But I do want a object member not a class member.</p>

<p>And I tried, if points is int, or some other simple type it works fine.</p>

<p>Besides, I know if I write</p>

<pre><code>def __init__(self) :
    self.points = []
</code></pre>

<p>it will also work, but I don't get why they are pointing to same list by default.</p>

<p>ps. I know writing a init will work.</p>

<pre><code>class line :
    name = "abc"

    def changename(self, name) :
        self.name = name

line1 = line()
line2 = line()
line1.changename(123)
print line2.name
</code></pre>

<p>But the code above output <code>"abc"</code></p>

<p>So I don't understand why same kind of declaration act different by type.</p>
