On Tue, 19 Jun 2007 18:54:41 +1000, Ben Finney wrote: > "Ethan Kennerly" <[EMAIL PROTECTED]> writes: > >> I really like properties for readonly attributes, > > Python doesn't have "readonly attributes", and to attempt to use > properties for that purpose will only lead to confusion.
class Parrot(object): def _plumage(self): return "Beautiful red plumage" plumage = property(_plumage) >>> parrot = Parrot() >>> parrot.plumage 'Beautiful red plumage' >>> parrot.plumage = "Ragged grey feathers" Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: can't set attribute It walks like a read-only attribute, it squawks like a read-only attribute, but since Python doesn't have read-only attributes, Ben must be right: using properties to implement read-only attributes will only lead to confusion. *wink* -- Steven. -- http://mail.python.org/mailman/listinfo/python-list