classification
Title: built-in types dict docs - construct dict from iterable, not iterator
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: docs@python, ezio.melotti, python-dev, terry.reedy, wolma, zach.ware
Priority: normal Keywords: patch

Created on 2014-05-19 08:10 by wolma, last changed 2014-06-03 00:45 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
dict_doc.patch wolma, 2014-05-19 08:10 review
Messages (4)
msg218784 - (view) Author: Wolfgang Maier (wolma) * Date: 2014-05-19 08:10
The docs for Python3.4 havethis to say about the arguments to the dict constructor:

class dict(**kwarg)
class dict(mapping, **kwarg)
class dict(iterable, **kwarg)

    Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments.

    If no positional argument is given, an empty dictionary is created. If a positional argument is given and it is a mapping object, a dictionary is created with the same key-value pairs as the mapping object. Otherwise, the positional argument must be an iterator object. Each item in the iterable must itself be an iterator with exactly two objects. The first object of each item becomes a key in the new dictionary, and the second object the corresponding value. If a key occurs more than once, the last value for that key becomes the corresponding value in the new dictionary.

This paragraph uses the term iterator twice when it should talk about an iterable instead.
I'm attaching the patch for this.

Best,
Wolfgang
msg219618 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-06-02 18:52
LGTM.
msg219652 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-06-03 00:43
New changeset 78da27d6f28f by Terry Jan Reedy in branch '2.7':
Issue 21533: Dicts take iterables, not iterators. Patch by Wolfgang Maier.
http://hg.python.org/cpython/rev/78da27d6f28f

New changeset 28665dc3a696 by Terry Jan Reedy in branch '3.4':
Issue 21533: Dicts take iterables, not iterators. Patch by Wolfgang Maier.
http://hg.python.org/cpython/rev/28665dc3a696
msg219653 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-03 00:45
Thanks for catching this, and for the patch.
History
Date User Action Args
2014-06-03 00:45:19terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg219653

stage: commit review -> resolved
2014-06-03 00:43:37python-devsetnosy: + python-dev
messages: + msg219652
2014-06-02 18:52:14zach.waresetmessages: + msg219618
2014-06-02 18:14:22ezio.melottisetnosy: + ezio.melotti, zach.ware
type: enhancement
2014-05-23 20:32:22terry.reedysetassignee: docs@python -> terry.reedy
stage: commit review

nosy: + terry.reedy
versions: + Python 2.7, Python 3.4, Python 3.5
2014-05-19 08:10:15wolmacreate