[docs] [issue9182] document “--” as a way to distinguish option w/ narg='+' from positional argument in argparse

Daniel Albeseder report at bugs.python.org
Sun Nov 21 10:44:09 CET 2010

Daniel Albeseder <kotan at gmx.at> added the comment:

Steven: From msg121850 I think the last two examples do not need the "--". Since there are no positional arguments, the "--" is not needed. However the following additional cases exist:

-x X [X ...] -y Y -- A B # since optionals might come in other order

Basically every of the three variable length classes need to be tested: ZeroOrOne, ZeroOrMore and OneOrMore. This might always come in a conflict with positional arguments needed afterward (even with optional positional arguments!).

BTW - I recognized the following seem to be supported:

for [-x [X ...]] -- [y ...] 
the following input: a -x -- b

I would expect to be 'a' and 'b' positional arguments and the optional '-x' has no argument. However this seem not to work. Another issue or desired behavior?


Python tracker <report at bugs.python.org>

More information about the docs mailing list