__getattr__, __setattr__

Discussion in 'Python' started by Thomas Heller, Oct 20, 2005.

  1. Just wondering about this behaviour, why is it this way?

    Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> object.__setattr__

    <slot wrapper '__setattr__' of 'object' objects>
    >>> object.__getattr__

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    AttributeError: type object 'object' has no attribute '__getattr__'
    >>>



    Thanks,

    Thomas
     
    Thomas Heller, Oct 20, 2005
    #1
    1. Advertising

  2. Thomas Heller

    Guest

    , Oct 20, 2005
    #2
    1. Advertising

  3. Thomas Heller

    Steve Holden Guest

    Thomas Heller wrote:
    > Just wondering about this behaviour, why is it this way?
    >
    > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32
    > Type "help", "copyright", "credits" or "license" for more information.
    >
    >>>>object.__setattr__

    >
    > <slot wrapper '__setattr__' of 'object' objects>
    >
    >>>>object.__getattr__

    >
    > Traceback (most recent call last):
    > File "<stdin>", line 1, in ?
    > AttributeError: type object 'object' has no attribute '__getattr__'
    >

    Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> object.__getattribute__

    <slot wrapper '__getattribute__' of 'object' objects>

    Ring any bells?

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC www.holdenweb.com
    PyCon TX 2006 www.python.org/pycon/
     
    Steve Holden, Oct 20, 2005
    #3
  4. "" <> writes:

    > for new style classes __getattribute__ is defined, see eg.
    > http://www.python.org/2.2.3/descrintro.html


    Steve Holden <> writes:

    > >>> object.__getattribute__

    > <slot wrapper '__getattribute__' of 'object' objects>
    >
    > Ring any bells?


    Yes, of course. Thanks ;-)

    Thomas
     
    Thomas Heller, Oct 20, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    0
    Views:
    419
    Anand
    Dec 18, 2003
  2. Chris Young

    Recursion with __setattr__

    Chris Young, Oct 16, 2005, in forum: Python
    Replies:
    0
    Views:
    372
    Chris Young
    Oct 16, 2005
  3. L.C. Rees
    Replies:
    3
    Views:
    395
    Scott David Daniels
    Feb 8, 2006
  4. Bruno Desthuilliers

    __getattr__, __setattr__ and pickle

    Bruno Desthuilliers, Aug 12, 2008, in forum: Python
    Replies:
    6
    Views:
    381
    Bruno Desthuilliers
    Aug 13, 2008
  5. aum
    Replies:
    1
    Views:
    140
Loading...

Share This Page