[IPython-user] I need feedback: new escape for @magics?

Fernando Perez Fernando.Perez at colorado.edu
Wed Sep 29 02:01:00 CDT 2004


Hi all,

while I'm almost ready to release ipython 0.6.4, I will have to wait a bit 
before starting the 'big cleanup' (yes, it's finally coming :) because I need 
to address the issue of @ being part of python's syntax as of python 2.4.

This means that I'll release 0.6.4 with @, and once I'm done with changing 
this I'll release 0.6.5, and _then_ I can start overhauling the internals.  I 
don't want to delay 0.6.4 on this issue because it contains important 
matplotlib-related fixes, and the @ change will be time-consuming.

For those of you who don't read python-dev or comp.lang.python, a 
micro-summary is:  Guido introduced a new syntax into the language for 
function decorators, using the @ character:

@classmethod
def foo():
...

is now valid python syntax.  This PEP discusses the topic in detail:
	http://www.python.org/peps/pep-0318.html

Guido was quite gracious in taking my input into account, but ultimately the 
decision was made to use the @ character for decorators, so IPython must adapt 
by changing the @magic escape.  I'd like to solicit feedback on what to use; I 
obviously want to make this change ONLY ONCE, since it's perfectly wasted time 
in my book.

My current candidate is '/', which somebody (can't remember who or where) 
suggested.  I like it because it's a binary operator, so

/magic foo bar

can never be valid python syntax as a first line (magics can only occur on 
single lines, not on continuation lines).  This makes it pretty future-proof.

It's also an easy to type character, and guaranteed to exist on all 
international keyboards (since it's the division operator).

Currently ipython uses / as an autocall escape, but that's a minor and obscure 
enough use that I'm willing to sacrifice it.  I'll either remove the feature 
altogether or (if someone complains) reassign it to some other escape.

So I'd like to hear from all of you on suggestions on this.  Even a simple +1 
vote is welcome, so at least I know that you agree.  If you disagree, please 
take the time to suggest an alternative, along with a short justification for 
it.  Also, please comment on whether you are OK with removing explicitly 
escaped autocalling or if you want me to keep the feature, assigning it to a 
different escape.

Thanks in advance to all.

Best,

Fernando.




More information about the IPython-user mailing list