[issue15125] argparse: positional arguments containing - in name not handled well

2021-12-10 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker ___

[issue15125] argparse: positional arguments containing - in name not handled well

2020-10-26 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15125] argparse: positional arguments containing - in name not handled well

2020-10-21 Thread Socob
Change by Socob <206a8...@opayq.com>: -- nosy: +Socob ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15125] argparse: positional arguments containing - in name not handled well

2019-08-29 Thread hai shi
hai shi added the comment: How about: 1. Adding documentation as steven said. 2. If user use '-' of positional arguments in latest cpython, we cloud remind user that `the '-' of positional arguments be replaced by '_' since cpython 4.0` 3.Applying Simon Law's patch. -- nosy:

[issue15125] argparse: positional arguments containing - in name not handled well

2019-07-29 Thread STINNER Victor
STINNER Victor added the comment: This issue is 7 years old and has 3 patches: it's far from being "newcomer friendly", I remove the "Easy" label. -- nosy: +vstinner ___ Python tracker

[issue15125] argparse: positional arguments containing - in name not handled well

2019-07-29 Thread STINNER Victor
Change by STINNER Victor : -- keywords: -easy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15125] argparse: positional arguments containing - in name not handled well

2014-08-23 Thread Keith Hughitt
Keith Hughitt added the comment: Although it would be nice if the behavior were normalized between positional and optional args, it seems like doc patch would be the most straight-forward at this point. The down-side is that I suspect many people will assume the behavior for optional args,

[issue15125] argparse: positional arguments containing - in name not handled well

2014-08-21 Thread paul j3
paul j3 added the comment: It still needs a documentation patch. And if the documentation was clearer, would sfllaw's patch still be needed? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125

[issue15125] argparse: positional arguments containing - in name not handled well

2014-08-19 Thread Keith Hughitt
Keith Hughitt added the comment: Any progress on this issue? Still persists in Python 3.4.1. -- nosy: +khughitt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___

[issue15125] argparse: positional arguments containing - in name not handled well

2013-08-24 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___ ___ Python-bugs-list

[issue15125] argparse: positional arguments containing - in name not handled well

2013-05-17 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___ ___ Python-bugs-list

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Simon Law
Simon Law added the comment: But patching the module to allow explicitly setting dest via keyword argument shouldn't hurt anybody. I agree that it wouldn't hurt anybody. If you can find a way to do this, feel free to provide a patch. However, the correct way to have one name for the

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Simon Law
Simon Law added the comment: Sorry, there was a small typo in the previous patch. Here's the newer version. -- Added file: http://bugs.python.org/file27860/15125-1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: Removed file: http://bugs.python.org/file27859/15125-1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Simon Law
Simon Law added the comment: Note that 15125-1.patch applies to Python 2.7 cleanly as it is a bugfix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Simon Law
Simon Law added the comment: 15125-2.patch applies to the default branch. It makes dest behave the same for positional and optional arguments in terms of name mangling. Also, there is a backward-compatibility path in Namespace to support old-style getattr() access. However, it's not

[issue15125] argparse: positional arguments containing - in name not handled well

2012-11-03 Thread Éric Araujo
Éric Araujo added the comment: Will apply the doc patches soon™ and wait for Steven’s feedback about the 3.4 behavior change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I'm sympathetic to the idea that '-' should be translated similarly for optional and positional arguments, but as you've noted, it would be a risky patch because it's already possible for people to use getattr on hyphenated arguments.

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-08 Thread Nicu Stiurca
Nicu Stiurca supernic2...@gmail.com added the comment: Florent, there are several reasons I think this is a valid use case. First, for optional arguments, '-' gets automatically replaced with '_' as the destination. I don't see any reason why optional and positional arguments should be

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-08 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Isn’t the obvious workaround to pass a dest argument which is a valid identifier? add_argument('spam-eggs', dest='spam_eggs') Maybe argparse in 3.4 could do this transformation automatically (see how namedtuple converts anything to valid

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-08 Thread Nicu Stiurca
Nicu Stiurca supernic2...@gmail.com added the comment: Eric: I agree, that would be the obvious workaround. However, it turns that the way dest is set differs for optional and positional arguments. I alluded to this in my earlier message http://bugs.python.org/issue15125#msg163456

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Ionuț Arțăriși
Ionuț Arțăriși io...@artarisi.eu added the comment: I'm working on this right now as part of EuroPython's CPython sprint. -- nosy: +mapleoin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Florent Xicluna
Florent Xicluna florent.xicl...@gmail.com added the comment: I don't see a valid use case to support - in the name of the positional argument. IMHO, it should raise an error (probably a ValueError) for the add_argument in this case ... Or we keep it as-is and close as wont-fix: if the op

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Ionuț Arțăriși
Ionuț Arțăriși io...@artarisi.eu added the comment: I agree with Florent that this is maybe just a documentation issue, since the argument is accessible via getattr(). -- keywords: +patch Added file: http://bugs.python.org/file26286/argparse-argument-names.diff

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-22 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15125 ___ ___

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-22 Thread Nicu Stiurca
Nicu Stiurca supernic2...@gmail.com added the comment: Re-selecting Python 2.6 under version (I think it was accidentally unselected). Here as another related error: if I try to add dest=baz to the a.add_argument() call, it throws ValueError: dest supplied twice for positional argument

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-22 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Nope, it was intentionally unselected. We use versions for the versions in which we will fix the bug, and 2.6 gets only security patches at this point. In any case, argparse isn't part of the stdlib in 2.6. -- versions:

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-22 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Oh, and to make sure your second report doesn't get lost, could you open another issue for the other bug, and give a complete example? -- ___ Python tracker rep...@bugs.python.org

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-21 Thread Nicu Stiurca
New submission from Nicu Stiurca supernic2...@gmail.com: To reproduce, try the following code: from argparse import ArgumentParser a = ArgumentParser() a.add_argument(foo-bar) args = a.parse_args([biz]) print args, args.foo_bar Expected output: Namespace(foo_bar='biz') biz Actual output:

[issue15125] argparse: positional arguments containing - in name not handled well

2012-06-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: It does. -- keywords: +easy nosy: +bethard, r.david.murray stage: - needs patch versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6 ___ Python tracker rep...@bugs.python.org