[issue9137] x.update(red=5, blue=6, other=7) doesn't work, where x is a MutableMapping

Daniel Stutzbach report at bugs.python.org
Thu Jul 1 17:12:42 CEST 2010


New submission from Daniel Stutzbach <daniel at stutzbachenterprises.com>:

Simple example, using collections.OrderedDict:

>>> import collections
>>> x = collections.OrderedDict()
>>> x.update(red=5, blue=6, other=7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/bin/../stow/Python-3.1.1/lib/python3.1/_abcoll.py", line 490, in update
    for key, value in other:
TypeError: 'int' object is not iterable

In MutableMapping.update, the first argument needs to be a positional-only argument.  Otherwise, it's impossible to use "other" as keyword argument to designate a key-value pair.

----------
assignee: stutzbach
messages: 109055
nosy: stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: x.update(red=5, blue=6, other=7) doesn't work, where x is a MutableMapping
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9137>
_______________________________________


More information about the Python-bugs-list mailing list