Does Python really follow its philosophy of "Readability counts"?
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Mon Jan 19 21:24:28 EST 2009
On Mon, 19 Jan 2009 18:07:50 -0800, Russ P. wrote:
> On Jan 19, 5:09 pm, Luis Zarrabeitia <ky... at uh.cu> wrote:
>
>> Russ, I think _you_ are missing the point. If the attribute is already
>> public, why does it need properties? Why would a programmer go to the
>> trouble of adding them manually, just to get one level of indirection
>> for an already public attribute?
>
> You don't understand the purpose of properties -- and you tell me that
> *I* am the one missing the point?
Well, I *thought* I did, and (unlike Bruno) I'm not hostile to the idea
Russ is proposing. But I must admit it's not clear to me why Russ thinks
it is a good idea to automatically turn this:
class Parrot(object):
def __init__(self):
self.x = 1
into this:
class Parrot(object):
def __init__(self):
self._x = 1
def getx(self):
return self._x
def setx(self, value):
self._x = value
x = property(getx, setx)
Because frankly, that's how I read Russ' explanation for what Scala is
doing. Have I missed something?
--
Steven
More information about the Python-list
mailing list