
Jan. 3, 2011
11:18 p.m.
It seems to me that one of the more common reasons for using @property is to create a read-only attribute. I wonder if it would make sense to simply create a read-only decorator. Compare: class Foo(object): _size = 4 @property def size(self): return _size against: class Foo(object): @read-only size = 4 This gets more interesting if decorators nest: class Foo(object): __metaclass__ = abc.ABCMeta @abstract @classattribute @read-only size = None --rich
5188
Age (days ago)
5189
Last active (days ago)
2 comments
3 participants
participants (3)
-
Antoine Pitrou
-
K. Richard Pixley
-
Scott Dial