[IPython-user] Using argparse to implement %magics
Robert Kern
robert.kern@gmail....
Tue Oct 28 14:31:31 CDT 2008
David Warde-Farley wrote:
> On 27-Oct-08, at 8:08 PM, Robert Kern wrote:
>
>> argparse is my command-line option parser of choice these days, and
>> I always thought it would be a nice way to implement some of the
>> IPython %magics that have such options. I recently had the occasion
>> to write some of my own %magics, so I tried it out. Here are the
>> results:
>
> These are really quite handy! %fread and %fwrite especially. They're
> so handy that they'd be perfect for inclusion in ipython, save for
> introducing another dependency, of which I know many people are wary.
One of the nice things about argparse is that it is a single-file Python module
intended to be dropped into places like IPython.external.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the IPython-user
mailing list