Message155157
> 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:20 | bethard | set | recipients:
+ bethard, v+python, guilherme-pg |
2012-03-08 10:16:20 | bethard | set | messageid: <1331201780.4.0.298775189789.issue14191@psf.upfronthosting.co.za> |
2012-03-08 10:16:19 | bethard | link | issue14191 messages |
2012-03-08 10:16:18 | bethard | create | |
|