[IPython-dev] Minus signs in argparse line magics

Matthew Brett matthew.brett at gmail.com
Fri Aug 10 18:49:24 EDT 2012


Hi,

On Fri, Aug 10, 2012 at 5:39 PM, MinRK <benjaminrk at gmail.com> wrote:
> You can use '--' to halt argument parsing in argparse, so you should be able
> to do:
>
> %R -- c(1, -1)

Yes, indeed - that was in my original mail as a workaround, but
understanding why that's a good idea requires understanding that the
whole line is being option parsed, and so it's a bit heavy on the eye,
and I found I was preferring either to use cell magics or adjust the
whitespace in the line to avoid the option parsing...

I think most people would expect the options to follow the magic
command and be clustered together, but would not expect to consider
options at any position in the input string.  I don't think there's a
way to make argparse do that by default...

Cheers,

Matthew



More information about the IPython-dev mailing list