[IPython-user] Re: Fairly deep changes in CVS, testers welcome

Thorsten Kampe thorsten at thorstenkampe.de
Mon Jun 21 03:49:17 CDT 2004


* Fernando Perez (2004-06-21 09:58 +0200)
> I know I recently put out a 'release candidate', but please bear with me. 
> I've committed a raft of pretty serious changes which do touch the critical 
> inner loops in ipython, so I'm a bit worried and would really like some feedback.
> 
> I hope to lure you in because the offered functionality is somewhat 
> interesting, IMHO.  I finally got around to rewriting the whole ipython alias 
> subsystem.  The old one was based on a trick which felt neat when I was in my 
> 2nd week of python learning (dynamic code generation and runtime modification 
> of the running instance method table).  In reality it was just a heavyweight 
> hack, which could be replaced by a simple, light dictionary.
> 
> With the new code in place, we now have:
> 
> In [1]: len(__IP.alias_table)
> Out[1]: 24
> 
> In [2]: rehash  # takes ~ 0.3 s to run on my laptop
> 
> In [3]: len(__IP.alias_table)
> Out[3]: 3652
> 
> rehash is a new magic which works just like the one in tcsh.  Which means we 
> can now do things like:
> [...]
> In particular, @rehash/x are very Unix-specific.  I don't know how to deal 
> with $PATH and how to make executability decisions under Windows, which (I 
> think) has a baroque extension-based mechanism for this.

Under Cygwin:

Python 2.3.4 (#1, Jun 13 2004, 11:21:03) 
Type "copyright", "credits" or "license" for more information.

IPython 0.6.1.cvs -- 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.
1>>> rehash
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)

/home/thorsten/<console> 

/usr/lib/python2.3/site-packages/IPython/Magic.py in magic_rehash(self=<IPython.iplib.InteractiveShell instance>, parameter_s='')
   1755         alias_table = self.shell.alias_table
   1756         for pdir in path:
-> 1757             for ff in os.listdir(pdir):
        ff = 'w9xpopen.exe', global os = <module 'os' from '/usr/lib/python2.3/os.pyc'>, global listdir = undefined, pdir = 'Z'
   1758                 # each entry in the alias table must be
(N,name), where
   1759                 # N is the number of positional arguments of
the alias.

OSError: [Errno 2] No such file or directory: 'Z'

Thorsten




More information about the IPython-user mailing list