I tried executing this piece of code in my Idle and have the following error,
class Myclass():
i = 1
x = Myclass()
x.y = 10
x.i=10
x.i
# 10
x.y
# 10
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?
object