[IPython-user] A simple magic-command question

Fernando Perez fperez at colorado.edu
Mon May 10 23:57:17 CDT 2004


Hi Viktor,

> I'm starting to get more familiar w/ IPython. - What is the reason that
> the provided magic-commands are mixed b/w upper- and lower-case ?
> 
> Or put differently, beside @Exit , @Pprint and @Quit, all other magic-
> commands are all-lower-case ...

For Exit and Quit:

In [6]: exit
Out[6]: 'Use Ctrl-D (i.e. EOF) to exit.'

In [7]: quit
Out[7]: 'Use Ctrl-D (i.e. EOF) to exit.'

In [8]: pdoc Exit
Exit IPython without confirmation.

In [9]: pdoc Quit
Exit IPython without confirmation (like @Exit).

Python by default prints a message for 'exit' or 'quit', and I've done a lot 
of work to try to replicate, as much as possible, standard python behavior. 
So I didn't want to change those, but I wanted to provide some command to exit 
unconditionally, hence the Capitalized versions.

Pprint controls the pretty-printing module, whose Python name is 'pprint'.  I 
just wanted a name which wouldn't collide with a standard python name.

Whenever possible, I've tried to make all magics be all lower-case, to keep 
with standard Unix command naming conventions.

Best,

f




More information about the IPython-user mailing list