[issue9625] argparse: Problem with defaults for variable nargs when using choices

2020-12-21 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2020-11-30 Thread Borhan Hafez
Change by Borhan Hafez : -- nosy: +zumoshi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2020-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Paul, what is your current thinking on this? -- ___ Python tracker ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2020-07-29 Thread James Corbett
James Corbett added the comment: I would love to get this issue resolved; it seems like everyone agrees that it's a bug. It came up for me recently: https://bugs.python.org/issue41047. Judging from the comments above, the consensus is that the relevant line, `self._check_value(action,

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-11-20 Thread Jan Hutař
Jan Hutař added the comment: I think there is a same issue with "nargs='+'" - if you are aware of the, please ignore me. $ python3 --version Python 3.7.5 With "choices=...", there seems to be a problem: $ cat bbb.py #!/usr/bin/env python3 import argparse parser =

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-11-18 Thread Mihail Milushev
Mihail Milushev added the comment: It looks like choices are broken for nargs='*' even without using default: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('test', nargs='*', choices=['foo', 'bar', 'baz']) _StoreAction(option_strings=[], dest='test',

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-08-30 Thread Raymond Hettinger
Change by Raymond Hettinger : -- priority: high -> normal versions: +Python 3.9 -Python 2.7, Python 3.5, Python 3.6 ___ Python tracker ___

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-08-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: bethard -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-07-12 Thread João Eiras
Change by João Eiras : -- nosy: -João Eiras ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2019-07-12 Thread João Eiras
João Eiras added the comment: Another workaround for who might ever need it. The benefit of this solution comparing to a custom type is that argparse will generate the help string properly with the choices, and this solution does workaround the place when the bug happens: class

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2018-10-16 Thread sebix
Change by sebix : -- nosy: +sebix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2018-04-26 Thread Freek Dijkstra
Change by Freek Dijkstra : -- nosy: +macfreek ___ Python tracker ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2017-01-19 Thread paul j3
paul j3 added the comment: Recent StackOverFlow question related to this issue http://stackoverflow.com/questions/41750896/python-argparse-type-inconsistencies-when-combining-choices-nargs-and-def/41751730#41751730 -- ___ Python tracker

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2017-01-19 Thread paul j3
Changes by paul j3 : -- priority: normal -> high ___ Python tracker ___ ___

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2016-06-12 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag stage: needs patch -> patch review versions: +Python 3.5, Python 3.6 -Python 3.2 ___ Python tracker

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2015-08-29 Thread Sworddragon
Changes by Sworddragon sworddrag...@aol.com: -- nosy: +Sworddragon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2014-05-01 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: Added file: http://bugs.python.org/file35128/notes.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2014-04-30 Thread paul j3
paul j3 added the comment: There's a complicating issue - should these default values be passed through the type function? In most cases in `_get_values`, the string first goes through `_get_value`, and then to `_check_value`. For example the 'else:' case: value =

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2013-07-08 Thread paul j3
paul j3 added the comment: The patch I just posted to http://bugs.python.org/issue16468 uses this fix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2013-07-03 Thread paul j3
paul j3 added the comment: Change choices='abc' to choices=['a', 'b', 'c'], as discussed in issue 16977 (use of string choices is a bad example) -- Added file: http://bugs.python.org/file30762/issue9625_2.patch ___ Python tracker

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2013-06-27 Thread paul j3
paul j3 added the comment: I've added 2 more tests, one with default='c', which worked before. one with default=['a','b'], which only works with this change. http://bugs.python.org/issue16878 is useful reference, since it documents the differences between nargs=? and nargs=*, and their

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2013-06-26 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list mailing list

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2013-06-15 Thread Cédric Krier
Cédric Krier added the comment: ping -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2012-11-03 Thread Cédric Krier
Cédric Krier added the comment: Here is a new version of the patch with tests -- nosy: +ced Added file: http://bugs.python.org/file27858/issue9625.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I agree that this looks like a bug. I think the fix is something like the attached patch, but it needs some tests to make sure that it fixes your problem. -- keywords: +patch Added file:

[issue9625] argparse: Problem with defaults for variable nargs

2012-01-23 Thread Michał M .
Michał M. pyt...@michalski.im added the comment: Of course I've made a mistake: list for user provided or list for default should be: list for user provided or STRING for default -- ___ Python tracker rep...@bugs.python.org

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2012-01-23 Thread Martin Pengelly-Phillips
Martin Pengelly-Phillips d...@thesociable.net added the comment: The real issue is that the choices flag does not work with a default flag and * nargs. The following works as expected: parser.add_argument('chosen', nargs='*', default=['a']) print(parser.parse_args()) Namespace(chosen=['a'])

[issue9625] argparse: Problem with defaults for variable nargs

2012-01-22 Thread Michał Michalski
Michał Michalski pyt...@michalski.im added the comment: Maybe it will sound strange, but what is this task REALLY about? I mean - I can see two problems here, but no clear information about which problem is a real problem and - if it is - what is the expected behavior. Problems I can see are:

[issue9625] argparse: Problem with defaults for variable nargs

2010-11-02 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs

2010-08-21 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - bethard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list

[issue9625] argparse: Problem with defaults for variable nargs

2010-08-17 Thread Martin Pengelly-Phillips
New submission from Martin Pengelly-Phillips d...@thesociable.net: Variable argument count plays badly with choices. Example: import argparse parser = argparse.ArgumentParser() parser.add_argument('choices', nargs='*', default='a', choices=['a', 'b', 'c']) args =

[issue9625] argparse: Problem with defaults for variable nargs

2010-08-17 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- nosy: +bethard stage: - needs patch versions: +Python 2.7, Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625

[issue9625] argparse: Problem with defaults for variable nargs

2010-08-17 Thread Eric Smith
Changes by Eric Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list mailing