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

2006-06-20 Thread Barry Kelly
Barry Kelly <[EMAIL PROTECTED]> wrote: > From "pydoc __getattribute__": > > ---8<--- > Help on method-wrapper object: > > __getattribute__ = class method-wrapper(object) > | Methods defined here: > | > | __call__(...) > | x.__call__(...) <==> x(...) > | > | __getattribute__(...

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

2006-06-20 Thread Ziga Seilnacht
Barry Kelly wrote: [snipped] > Yet when I try this with the 'type' type, it doesn't work: > > ---8<--- > >>> x.__class__.__class__ > > >>> x.__class__.__getattribute__('__class__') > Traceback (most recent call last): > File "", line 1, in ? > TypeError: descriptor '__getattribute__' requires a

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

2006-06-20 Thread Bruno Desthuilliers
Barry Kelly a écrit : > I'm running this version of Python: > > Python 2.4.3 (#1, May 18 2006, 07:40:45) > [GCC 3.3.3 (cygwin special)] on cygwin > > I read in the documentation that these two expressions are > interchangeable: > > x.__getattribute__('name') <==> x.name I wouldn't say th

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

2006-06-20 Thread Scott David Daniels
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, bu

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

2006-06-20 Thread Maric Michaud
Le Mardi 20 Juin 2006 18:36, Barry Kelly a écrit : > Yet when I try this with the 'type' type, it doesn't work: > > ---8<--- > > >>> x.__class__.__class__ > > > > >>> x.__class__.__getattribute__('__class__') > you're looking for getattr : In [11]: getattr(object, '__class__') Out[12]: In [13]:

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

2006-06-20 Thread Barry Kelly
I'm running this version of Python: Python 2.4.3 (#1, May 18 2006, 07:40:45) [GCC 3.3.3 (cygwin special)] on cygwin I read in the documentation that these two expressions are interchangeable: x.__getattribute__('name') <==> x.name >From "pydoc __getattribute__": ---8<--- Help on method-