Activity log for bug #244677

Date Who What changed Old value New value Message
2008-07-01 20:02:08 Angelo Bonet bug added bug
2008-07-01 20:14:44 Angelo Bonet description Python seems to call an object's __getattr__ function inconsistently and at times when regular Python does not. According to the Python documentation on __getattr__: "if the attribute is found through the normal mechanism, __getattr__() is not called." In the following examples, myobj has a bound method named "myfunc" defined and as well as a "__getattr__" method defined. 1) "myobj.myfunc()" In this example, IPython first calls myobj.__getattr__, before calling myfunc. 2) "myobj.myfunc ()" Introducing white-space between "myfunc" and "()" eliminates IPython's __getattr__ call 3) "myobj.myfunc( )" Introducing white-space between the parens "( )" eliminates IPython's __getattr__ call 4) "x = myobj.myfunc()" In this assignment statement, IPython does not call __getattr__. In all of the above examples, regular Python *never* calls the object's __getattr__ routine, only myfunc is called. IPython seems to call an object's __getattr__ function inconsistently and at times when regular Python does not. According to the Python documentation on __getattr__: "if the attribute is found through the normal mechanism, __getattr__() is not called." In the following examples, myobj has a bound method named "myfunc" defined and as well as a "__getattr__" method defined. 1) "myobj.myfunc()" In this example, IPython first calls myobj.__getattr__, before calling myfunc. 2) "myobj.myfunc ()" Introducing white-space between "myfunc" and "()" eliminates IPython's __getattr__ call 3) "myobj.myfunc( )" Introducing white-space between the parens "( )" eliminates IPython's __getattr__ call 4) "x = myobj.myfunc()" In this assignment statement, IPython does not call __getattr__. In all of the above examples, regular Python *never* calls the object's __getattr__ routine, only myfunc is called.
2008-07-02 04:15:16 Angelo Bonet title IPython calls an object's __getattr__ inconsistently IPython calls an object's __getattr__ incorrectly
2009-04-21 03:47:11 Brian Granger ipython: status New Incomplete