[Edu-sig] quantum instance

Arthur ajsiegel at optonline.net
Fri Sep 16 06:03:34 CEST 2005



> -----Original Message-----
> From: Kirby Urner [mailto:urnerk at qwest.net]
> > OTOH, his general explanation for the use case of properties in respect
> to
> > API design seemed to me to be a perfect defense of the extensive use of
> a
> > pattern of:
> >
> > @property
> > def getx(self):
> >    return self._x
> >
> > @porperty
> > def sety(self,x)
> >    self._x =x
> >
> > because while now x is a normal attribute you never know what tomorrow
> may
> > bring.
> 
> And I say such defensive programming is unnecessary in Python.  You can
> turn
> 'x' into a property later

Yes. John explains this as well. 

I told you I was confused.

But I remain confused to the extent that this  - from where I sit - rather
obscure and remote situation comes up prominently as a reason properties are
so welcome as a builtin function. As I don't think I sit anywhere *that* far
off the mainstream of things.  As an emergency fix - __getattr_ and
__setattr__ would serve as well.  "As well" as in also.  As well as in "as
well as" I guess is open to debate, but I keep thinking we are in obscure
corner of things in any case - and having to get there as a use case for
properties implies a stretch, and for me, is therefore a source of
suspicion.

Art




More information about the Edu-sig mailing list