Issue 22918: Doc for iter makes inexact comment about dict.iter (original) (raw)

Issue22918

Created on 2014-11-22 20:49 by eric.araujo, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue22918-inexactComment.diff krypten,2014-12-10 10:51 File for resolving issue 22918. Second half of comment sentence removed as stated in messages. review
Messages (9)
msg231529 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-11-22 20:49
https://docs.python.org/3/reference/datamodel#object.__iter__ > This method should return a new iterator object that can iterate over all the objects > in the container. For mappings, it should iterate over the keys of the container, and > should also be made available as the method keys(). In 3.x, d.__iter__() is not equivalent to d.keys() but to iter(d.keys()).
msg231536 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-11-22 22:36
They aren't equivalent in python2, either. I think probably the wording should be changed to something like "and the method keys() should return an iterable that provides access to the same data".
msg231543 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-11-23 01:05
The Python 2 doc is alright, the same line says that d.__iter__() is equivalent to d.iterkeys().
msg231546 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-11-23 05:49
Ah, I see. So the python3 docs should say "and should be equivalent to iter(dict.keys())" ? Or maybe the whole phrase should just be dropped.
msg231571 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-11-23 16:57
I think the first half of the sentence is enough: “For mappings, it should iterate over the keys of the container.”
msg231843 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-11-29 00:25
Since .iterkeys is gone, I thing the ', and' part should just be dropped.
msg232361 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-12-09 10:18
> I think the first half of the sentence is enough: > “For mappings, it should iterate over the keys of the container.” That should do it :-)
msg232428 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-12-10 14:51
New changeset 743ebaba14db by R David Murray in branch '3.4': #22918: Drop obsolete mention of 'keys' in datamodel __iter__ docs. https://hg.python.org/cpython/rev/743ebaba14db New changeset 1a1f577ca647 by R David Murray in branch 'default': Merge: #22918: Drop obsolete mention of 'keys' in datamodel __iter__ docs. https://hg.python.org/cpython/rev/1a1f577ca647
msg232429 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-12-10 14:52
Thanks, Chaitanya.
History
Date User Action Args
2022-04-11 14:58:10 admin set github: 67107
2014-12-10 14:52:41 r.david.murray set status: open -> closedtype: behaviormessages: + resolution: fixedstage: needs patch -> resolved
2014-12-10 14:51:48 python-dev set nosy: + python-devmessages: +
2014-12-10 10:51:40 krypten set files: + issue22918-inexactComment.diffkeywords: + patch
2014-12-09 10🔞56 rhettinger set nosy: + rhettingermessages: +
2014-11-29 00:25:50 terry.reedy set nosy: + terry.reedymessages: +
2014-11-23 16:57:49 eric.araujo set messages: +
2014-11-23 05:49:55 r.david.murray set messages: +
2014-11-23 01:05:39 eric.araujo set messages: +
2014-11-22 22:36:32 r.david.murray set nosy: + r.david.murraymessages: +
2014-11-22 20:49:39 eric.araujo create