On 1/3/2011 5:31 PM, Antoine Pitrou wrote:
On Mon, 03 Jan 2011 14:18:42 -0800 "K. Richard Pixley" rich@noir.com wrote:
class Foo(object): @read-only size = 4
What's wrong with:
class Foo:
... @property ... def foo(self): ... return 4 ...
Foo().foo
4
Foo().foo = 5
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: can't set attribute
?
s/4/Bar()/:
class Foo:
... @property ... def foo(self): ... return Bar()