At 12:55 PM 11/1/2001 -0800, Mike Orr wrote:
>On Thu, Nov 01, 2001 at 12:40:27PM -0600, Ian Bicking wrote:
> > I don't know who all noticed it, but Python 2.2 seems to add a feature
> > to make individual attribute accesses fully dynamic -- i.e., with a
> > getter, setter, and deleter. This potentially alleviates the need for
> > the *() and set*() functions that are all over the place -- and
> > without fancy/annoying __getattr__ magic.
> >
> > http://www.amk.ca/python/2.2/index.html#SECTION000340000000000000000
>
>They are definitely very intriguing. I think they're getting off
>to a slow start because they've been underdocumented. Guido's 2.2
>document (or maybe it was this one) only described them by example
>without the explanation--making you think they're good for *something*,
>but you're not quite sure what. As ppl talk more about where they can
>be useful, ppl will have a better feel for it.
>
>Also, the interface changed on this. There was a "getset" function for
>a while that seems to have disappeared, and ppl were waiting to see
>whether this property interface was here to stay.
Yes, the interface did change and I wasn't even aware of it until now!
I'd still like to see it rolled into the def part as in "defget" and
"defset" or even "get" and "set" in place of "def". This would make it feel
more like a part of the language and be a bit smoother.
Nonetheless, the 2 versions I have seen so far are a big improvement over
the __getattr__ hook and the ugliness that came with it.
I've been having the same thoughts as Ian--that once this feature settles
down and provided that it is convenient and stable--we could move from:
print self.foo()
self.setFoo(1)
self._foo = value
to:
print self.foo
self.foo = 1
self.foo = value
I think the result is:
* Much more convenient for writing and reading
* Much more Pythonic
We would need a script to convert existing Webware projects to the fullest
extent possible.
But finally, I haven't brought this up before because this feature really
needs to stabilize and get hammered on in Python 2.2 for a while before we
can embrace it.
-Chuck
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss