Comment 2 for bug 244677

Revision history for this message
Angelo Bonet (abonet) wrote : Re: IPython calls an object's __getattr__ inconsistently

That's interesting. I'm running 0.8.4 w/Python 2.4.3. I've also experienced the same behavior with 0.7.2

Using your same example:

~/notes/ipython> ipython
Python 2.4.3 (#1, Jan 14 2008, 18:32:40)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.4 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: !cat foo.py
class foo(object):
    def __getattr__(self, attr):
        print 'Getting %r' % attr

    def myfunc(self):
        print 'myfunc()'

In [2]: import foo

In [3]: f = foo.foo()

In [4]: f.myfunc()
Getting 'myfunc()'
myfunc()

In [5]: f.myfunc ()
myfunc()