[issue32595] Deque with iterable object as one object

Raymond Hettinger report at bugs.python.org
Thu Jan 18 15:27:49 EST 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Sorry Jonathan, this is the way the python containers work if they take an iterable input.  In the case of a str, it is not possible for us to know whether you mean for deque('abc') to go it as three arguments or as one.

FWIW, if you don't what to put the single element in a list, the API provides the append() method for adding scalars and extend() method for adding iterables:

   d = deque()
   d.append('abc')
   d.extend('abc')

Note that lists behave the same way.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list