[issue40365] argparse: action "extend" with 1 parameter splits strings into characters

Jonathan Haigh report at bugs.python.org
Tue Jun 9 09:20:45 EDT 2020


Jonathan Haigh <jonathanhaigh at gmail.com> added the comment:

>> But I wonder, was this situation discussed in the original bug/issue?
>Doesn't look like it:

I was looking at the wrong PR link. This has more discussion: https://github.com/python/cpython/pull/13305.

nargs is discussed but I'm not sure it was realized that the nargs=None and nargs="?" cases would act in the way seen here rather than acting like append.

Having a default nargs of "+" was suggested but that suggestion was not addressed.

> I suggest that the default nargs for extend should be "*" or "+" and an exception should be raised if nargs is given as "?".

I'm not convinced about that any more. Using append's behaviour is probably more reasonable for nargs=None and nargs="?".

----------
nosy: +Anthony Sottile, BTaskaya, berker.peksag

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40365>
_______________________________________


More information about the Python-bugs-list mailing list