[IPython-user] Unexpected behavior on __getattribute__ in Ipython

Wong, Shin Guey shin.guey.wong@intel....
Tue Aug 4 20:45:49 CDT 2009


Thanks, it works correctly after I turn off autocall.

Regards,
Shin Guey

-----Original Message-----
From: Kenneth Arnold [mailto:kenneth.arnold@gmail.com] 
Sent: Tuesday, August 04, 2009 9:33 PM
To: Wong, Shin Guey
Cc: ipython-user@scipy.org
Subject: Re: [IPython-user] Unexpected behavior on __getattribute__ in Ipython

I suspect autocall. Try `autocall 0`.
-Ken



On Tue, Aug 4, 2009 at 6:24 AM, Wong, Shin Guey<shin.guey.wong@intel.com> wrote:
> 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
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>


More information about the IPython-user mailing list