Message367045
This is a consequence of Python's own definition of append vs extend
In [730]: alist = []
In [731]: alist.append('astring')
In [732]: alist
Out[732]: ['astring']
In [733]: alist.extend('astring')
In [734]: alist
Out[734]: ['astring', 'a', 's', 't', 'r', 'i', 'n', 'g']
In [735]: alist.extend(['astring'])
In [736]: alist
Out[736]: ['astring', 'a', 's', 't', 'r', 'i', 'n', 'g', 'astring']
Normally 'add_argument' doesn't check for valid parameters, but some Action subclasses do their own checking,
'extend' inherits the nargs==0 test from 'append'. (extend just modifies the __call__, not the __init__ method.
But I wonder, was this situation discussed in the original bug/issue? |
|
Date |
User |
Action |
Args |
2020-04-22 19:26:48 | paul.j3 | set | recipients:
+ paul.j3, rhettinger, strjan |
2020-04-22 19:26:48 | paul.j3 | set | messageid: <1587583608.2.0.638995294593.issue40365@roundup.psfhosted.org> |
2020-04-22 19:26:48 | paul.j3 | link | issue40365 messages |
2020-04-22 19:26:48 | paul.j3 | create | |
|