Python class definition assigning attributes
<p>I tried executing this piece of code in my Idle and have the following error,</p>

<pre><code>class Myclass():
    i = 1

x = Myclass()
x.y = 10
x.i=10
x.i
# 10
x.y
# 10
</code></pre>

<p>This class has only 1 attribute 'i', but when I assign x.y = 10, how will Python allow it to work. Isn't that a problem? How do I prevent it happening?</p>
