Define the y var on the class-level attribute. You will need to initialize it to something, even it's an empty list (as you were doing before).
>>> class X:
... y = []
... def __init__(self):
... pass
Update based on your comments:
You mentioned that you were mixed on the terminology (I'm assuming between class and instance variables), so here's what'll happen if you use this class (and is probably not what you want).
>>> class X:
... y = [] # Class level attribute
... def __init__(self):
... pass
...
>>> x = X()
>>> x.y.append(1)
>>> x.y
[1]
>>> x.y.append(2)
>>> z = X()
>>> z.y.append(3)
>>> z.y
[1, 2, 3]
>>> X.y.append(4)
>>> [1, 2, 3, 4]
Notice that when you add a variable to the class it sticks around between constructions. In the previous code we instantiated the variable x and the variable z as an instance of X. While we added to the y variable in the z instance, we still appended to the class variable y. Note on the very last line (X.y.append(4)) I append an item using a reference to the class X.
What you probably want is based off of your original post:
>>> class X:
... def __init__(self, y=None):
... self.y = y or list() # Instance level attribute. Default to empty list if y is not passed in.
...
>>> x = X()
>>> x.y.append(1)
>>> x.y
[1]
>>> z = X()
>>> z.y.append(2)
>>> z.y
[2]
>>>
>>> s = X()
>>> s.y
[]
>>> t = X(y=[10])
>>> t.y
[10]
Notice how a new list is created with each instance. When we create a new instance z and try to append to the y variable we only get the value that was appended, rather than keeping all of the existing additions to the list. In the last instantiation (t) example the constructor passes in the y parameter in it's construction, and thus has the list [10] as it's y instance variable.
Hopefully that helps. Feel free to ask any more uncertainties as comments. Also, I would suggest reading up on the Python class documentation here.