[IPython-user] Unexpected behavior on __getattribute__ in Ipython

Wong, Shin Guey shin.guey.wong@intel....
Tue Aug 4 05:24:07 CDT 2009


Here is the code:
class A(object):
    def __getattribute__(self, name):
        print "__getattribute__ called"
        return object.__getattribute__(self, name)
   
    y = "hello"

a = A()
print a.y
print
print A.y

expected --output:--
__getattribute__ called
hello

hello
================================================
but I get --output: --
__getattribute__ called
__getattribute__ called
hello

hello
==================================================

Can anyone duplicate this behavior? Or it is only happened at my setup?
When I run it without Ipython, I can get eh expected output.

Regards,
Shin Guey


More information about the IPython-user mailing list