Python property decorator not working, why?

后端 未结 1 707
情深已故
情深已故 2020-12-18 01:47

For some reason the \'obj._max_value\' and \'obj._current_value\' are not getting set. I have looked at many tutorials and it seems that I am doing it correctly. Does anyone

1条回答
  •  太阳男子
    2020-12-18 02:17

    The property decorator doesn't work with old-style classes. Inherit your class from object to get a new-style class:

    class Progress(object):
        # ...
    

    0 讨论(0)
提交回复
热议问题