1 Mar 02:20
Is ipython too nosy?
Alexander Schmolck <a.schmolck <at> gmx.net>
2007-03-01 01:20:01 GMT
2007-03-01 01:20:01 GMT
Hi,
I would have expected that ipython's (default) policy when the user enters a
line that constitutes a valid python expression and presses return would be to
evaluate the whole expression and not attempt any form of introspection on any
of the constituents.
Not so:
Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
Type "copyright", "credits" or "license" for more information.
IPython 0.7.3 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: class foo(object):
def __getattr__(self,attr):
print 'getattr: ', attr; return lambda *args, **kwargs: 'nada'
...: ...: ...:
In [2]: f=foo()
In [3]: f.bar()
getattr: bar()
getattr: bar
Out[3]: 'nada'
(Continue reading)
RSS Feed