[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

Anders Kaseorg report at bugs.python.org
Tue Jul 27 01:18:01 CEST 2010

Anders Kaseorg <andersk at mit.edu> added the comment:

>   arguments = *(positional-argument / option) [-- *(positional-argument)]
>   positional-argument = string
>   option = foo-option / bar-option
>   foo-option = "--foo" string
>   bar-option = "--bar"

Er, obviously positional arguments before the first ‘--’ can’t begin with a dash (I don’t think there’s any confusion over how those should work).
  arguments = *(non-dash-positional-argument / option) ["--" *(positional-argument)]
  non-dash-positional-argument = <string not beginning with "-">
  positional-argument = string

The point was just that the grammar unambiguously allows the argument of --foo to be any string.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list