Author bethard
Recipients bethard, guilherme-pg, v+python
Date 2012-03-08.10:16:18
SpamBayes Score 2.27596e-15
Marked as misclassified No
Message-id <1331201780.4.0.298775189789.issue14191@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-03-08 10:16:20bethardsetrecipients: + bethard, v+python, guilherme-pg
2012-03-08 10:16:20bethardsetmessageid: <1331201780.4.0.298775189789.issue14191@psf.upfronthosting.co.za>
2012-03-08 10:16:19bethardlinkissue14191 messages
2012-03-08 10:16:18bethardcreate