Skip to content Skip to sidebar Skip to footer

Python Setter Does Not Change Variable

May be I do not completely understand the concept of properties in python, but I am confused by the behaviour of my Python program. I have a class like this: class MyClass(): de

Solution 1:

The class should inherit object class (in other word, the class should be new-style class) to use value.setter. Otherwise setter method is not called.

class MyClass(object):
              ^^^^^^

Post a Comment for "Python Setter Does Not Change Variable"