[Python-Dev] Pre-PEP: Attribute Access Handlers v2
Paul Prescod
paul@prescod.net
Fri, 21 Jul 2000 16:54:24 -0500
Gordon McMillan wrote:
>
> You can? Your proposal only specified that when the class
> object is being created, method names of the form
> __attr_XXX__ would cause stuff to happen in the way the class
> is built. You never said that accesses to things named
> __YYY_XXX__ on another object would also get transformed
> into something else.
I would say that __attr_XXX__ causes two things to go into the __dict__:
__attr_XXX___ = <unbound method....>
XXX = <attribute accessor for XXX>
So you can call __attr_XXX__ directly just as you can call __getattr__
directly or __init__ etc.
> Deep inheritance hierarchies are unpythonic <0.001 wink>.
I'm told that in Zope even shallow hiearchies that use __getattr__ cause
problems. I proposed this idea about three years ago. I'm only bringing
it up again now because of a problem getting the DOM to work with Zope
because of Zope's use of __getattr__. I'm told this has gotten better
recently but I still see it as a symptom of a problem.
--
Paul Prescod - Not encumbered by corporate consensus
New from Computer Associates: "Software that can 'think', sold by
marketers who choose not to."