[IPython-user] A corner-case where ipython fails, and a feature idea

Fernando Perez Fernando.Perez at colorado.edu
Thu Nov 17 15:01:43 CST 2005


Abel Daniel wrote:

> In [2]:l=[];l.sort?
> Object `l=[];l.sort` not found.
> 
> In [3]:l=[]
> 
> In [4]:l.sort?
> Type:		builtin_function_or_method
> Base Class:	<type 'builtin_function_or_method'>
> String Form:	<built-in method sort of list object at 0xb7a4bd8c>
> Namespace:	Interactive
> Docstring:
>     L.sort(cmpfunc=None) -- stable sort *IN PLACE*; cmpfunc(x, y) -> -1, 0, 1

This is OK and won't change.  The ? feature does not handle compound 
statements.  It's a simple information feature, not a 
compiler-within-a-compiler, and that is never going to change.  It's a 
limitation imposed by trying to keep the system simple and reliable.

> And the feature idea: currently the following fails:
> In [5]:import?
> Object `import` not found.
> 
> I guess it would be nice if one could get basic information about
> statements, like 'import', 'if', etc. with 'statement?'. Although such
> might be superflous for seasoned pythoneers, it could be helpful for
> beginners.

This is certainly not a bad idea.  I want to think a little more about ? 
though, because I also want to incorporate the ability to search for things in 
other ways (we already have the wildcards in SVN, but I'm interested in 
keyword-type searches).  So before cluttering more the ? character, we need to 
decide how best to implement a good interactive information system.  Scipy has 
some facilities for that which we can steal, it's a matter of deciding on the 
best desired behavior.

Cheers,

f




More information about the IPython-user mailing list