@@ -4505,14 +4505,14 @@ can be used interchangeably to index the same dictionary entry.
4505
4505
``dict([('foo', 100), ('bar', 200)]) ``, ``dict(foo=100, bar=200) ``
4506
4506
4507
4507
If no positional argument is given, an empty dictionary is created.
4508
- If a positional argument is given and it is a mapping object , a dictionary
4509
- is created with the same key-value pairs as the mapping object. Otherwise,
4510
- the positional argument must be an :term: ` iterable ` object. Each item in
4511
- the iterable must itself be an iterable with exactly two objects. The
4512
- first object of each item becomes a key in the new dictionary, and the
4513
- second object the corresponding value. If a key occurs more than once, the
4514
- last value for that key becomes the corresponding value in the new
4515
- dictionary.
4508
+ If a positional argument is given and it defines a `` keys() `` method , a
4509
+ dictionary is created by calling :meth: ` ~object.__getitem__ ` on the argument with
4510
+ each returned key from the method. Otherwise, the positional argument must be an
4511
+ :term: ` iterable ` object. Each item in the iterable must itself be an iterable
4512
+ with exactly two elements. The first element of each item becomes a key in the
4513
+ new dictionary, and the second element the corresponding value. If a key occurs
4514
+ more than once, the last value for that key becomes the corresponding value in
4515
+ the new dictionary.
4516
4516
4517
4517
If keyword arguments are given, the keyword arguments and their values are
4518
4518
added to the dictionary created from the positional argument. If a key
@@ -4669,10 +4669,11 @@ can be used interchangeably to index the same dictionary entry.
4669
4669
Update the dictionary with the key/value pairs from *other *, overwriting
4670
4670
existing keys. Return ``None ``.
4671
4671
4672
- :meth: `update ` accepts either another dictionary object or an iterable of
4673
- key/value pairs (as tuples or other iterables of length two). If keyword
4674
- arguments are specified, the dictionary is then updated with those
4675
- key/value pairs: ``d.update(red=1, blue=2) ``.
4672
+ :meth: `update ` accepts either another object with a ``keys() `` method (in
4673
+ which case :meth: `~object.__getitem__ ` is called with every key returned from
4674
+ the method). or an iterable of key/value pairs (as tuples or other iterables
4675
+ of length two). If keyword arguments are specified, the dictionary is then
4676
+ updated with those key/value pairs: ``d.update(red=1, blue=2) ``.
4676
4677
4677
4678
.. method :: values()
4678
4679
0 commit comments