[IPython-dev] Minus signs in argparse line magics
Fri Aug 10 17:49:24 CDT 2012
On Fri, Aug 10, 2012 at 5:39 PM, MinRK <firstname.lastname@example.org> 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...
More information about the IPython-dev