How to Use Getter Without Setter
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay
--
Chapters
00:00 Question
01:10 Accepted answer (Score 8)
01:31 Thank you
--
Full question
https://stackoverflow.com/questions/4186...
Accepted answer links:
[new-style classes]: https://docs.python.org/2/reference/data...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python27 #properties #python2x #gettersetter
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay
--
Chapters
00:00 Question
01:10 Accepted answer (Score 8)
01:31 Thank you
--
Full question
https://stackoverflow.com/questions/4186...
Accepted answer links:
[new-style classes]: https://docs.python.org/2/reference/data...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python27 #properties #python2x #gettersetter
#avk47
ACCEPTED ANSWER
Score 7
You'll need to inherit from object for properties to work properly.
class Test(object):
...
That's because properties are implemented with descriptors and only new-style classes support descriptors.