This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bethard
Recipients bethard, guilherme-pg, v+python
Date 2012-03-08.10:16:18
SpamBayes Score 2.2759572e-15
Marked as misclassified No
Message-id <>
> Hence, I conclude that, unless this was spelled out in the PEP and I 
> missed it, that having such boundaries is a bug

Practically speaking, we just can't change this because it will break existing argparse scripts. Argparse has had this behavior since 2006 when it was first released, and I guarantee you that many scripts expect and rely on this behavior.

As I said earlier, the only reasonable solution is to document the current behavior more explicitly, and then add a new constructor parameter or method or something to enable the behavior you want.

I looked a bit a guilherme's patch, and I think it's not really the right direction. We definitely shouldn't be modifying the action classes like _StoreAction. All changes should be within _parse_known_args. The parsing algorithm is so different for the proposed behavior, that I wonder if it wouldn't be easier to just create a new ArgumentParser subclass, ArgumentParserAllowingOptionalsInsidePositionals (or whatever), that just overrides _parse_known_args and rewrites it entirely.
Date User Action Args
2012-03-08 10:16:20bethardsetrecipients: + bethard, v+python, guilherme-pg
2012-03-08 10:16:20bethardsetmessageid: <>
2012-03-08 10:16:19bethardlinkissue14191 messages
2012-03-08 10:16:18bethardcreate