__getattribute__ doesn't work on 'type' type for '__class__'

Scott David Daniels scott.daniels at acm.org
Tue Jun 20 15:18:19 EDT 2006


Barry Kelly wrote:
> I read in the documentation that these two expressions are
> interchangeable:
>   x.__getattribute__('name') <==> x.name

I think you'll find:
             getattr(x, 'name') <==> x.name

is what is equivalent.  You can define a '__getattribute__'
method which will get used, but I doublbt thre is a promise for
an exposed name '__getattribute__'.

-- 
--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list