Steven Bethard <steven.beth...@gmail.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14191>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to