paul j3 <[email protected]> added the comment:
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?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40365>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com