[IPython-dev] Towards IPython 1.0, the famous big cleanup

Fernando Perez Fernando.Perez at colorado.edu
Fri May 13 15:49:15 CDT 2005


Ville Vainio wrote:
> On Fri, 2005-04-15 at 12:27 -0600, Fernando Perez wrote:
> 
> 
>>>Do we need a magic system at all?
> 
> 
>>Well, that's pretty much what they do today.  It's just that making a new 
>>magic involves binding by hand an instance method with a special name, for 
>>example:
> 
> 
> Yeah, but it's still "magic system". It could be just a bunch of normal
> python objects, visible normally, without a need to lookup a special
> dictionary of magic methods (and another for aliases, etc.).

Well, I still think it's worth making them special and isolated, for a number 
of reasons:

- I don't want to pollute the user's namespace with these names.  Currently 
you can do:

In [11]: ls e*py
error.py*  err.py  exit2.py*  exit.py*

In [12]: ls=1

In [13]: ls
Out[13]: 1

In [14]: del ls

In [15]: ls e*py
error.py*  err.py  exit2.py*  exit.py*

This becomes impossible if you stuff them into the users' namespace.

- Currently, %who shows you a clean namespace when you start, without a 
zillion aliases/magics.  Do you really want to wade through a list of 3000 
aliases every time you want to see what variables you've defined?

- Magics behave like command-line utilities: --switch for options, whitespace 
separating arguments.  I want to make it even easier to write new magics by 
exposing the option-handling machinery.  This is part of what makes them 
convenient to use, since there's a lot less typing of commas, parens and quotes.

For these reasons, and a 'gut' feeling that I'm right, I think it really does 
make sense to have a special system to handle these.  But keep the debate 
coming, since now I'm really starting to work on this stuff, it's time to 
hammer out what the best decision is for the long run, and I'm willing to 
change my mind if a good argument is made.

Best,

f




More information about the IPython-dev mailing list