New PEP: Attribute Access Handlers

Robin Becker robin at jessikat.fsnet.co.uk
Sat Jul 22 03:25:06 EDT 2000


In article <397933DA.46B072BF at roguewave.com>, Bjorn Pettersen
<bjorn at roguewave.com> writes
....
>> > Perhaps you should add a few words about why you chose __attr_XXX__
>> > instead of __set/get/del_XXX__?
>> 
>> That was actually the first proposal. But inheritance could get
>> confusing if you inherited set without get or get without set etc.
>
>Hmmm... I'm not quite sure I understand... With __set/get/del_XXX__
>defined in a superclass you would automatically inherit all of them and
>could choose to only override one of them, e.g. if you wanted to perform
>further checks on a set but the get was the same.  With __attr_XXX__ you
>would have to explicitly call the superclass' __attr_XXX__ method if you
>didn't define all of set/get/del(?)  I have a feeling I'm missing
>something...
...
I prefer the fine control version, but couldn't you have both or is that
too un-pythonic
-- 
Robin Becker



More information about the Python-list mailing list