Renaming __getattribute__ (PEP?)

Nick Coghlan ncoghlan at iinet.net.au
Mon Dec 13 10:06:41 CET 2004


Henry 'Pi' James wrote:
> This whole issue seems so obvious and trivial to me that I've in fact
> expected it to be resolved by itself

Obvious - arguable
Trivial - I think so too, but probably not in the way you mean

The obviousness is arguable because the differences between __getattr__ and 
__getattribute__ are genuinely subtle and changing the name of the latter won't 
alter that. A single attribute access may actually pass through both methods at 
different points in the process. (It could be said that the similarity in names 
is actually advantageous, as it corresponds to the similarity in function)

Python makes it fairly easy to override attribute access, but it can't eliminate 
the basic complexity of the idea - if you want to override builtin behaviour, 
it's necessary to understand what the builtin behaviour *is* first.

On the triviality aspect, the amount of work involved in changing the name far 
exceeds any slight aesthetic improvement from a new name. And that's without 
even getting into the issues of backwards compatibility. I'd prefer to see the 
developers making speed improvements or adding to the standard library, rather 
than working on changing the names of special methods.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list