@@ -273,23 +273,24 @@ dictionary's keys::
273273
274274 >>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,
275275 ... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
276- >>> for key in m: #doctest: +SKIP
276+ >>> for key in m:
277277 ... print(key, m[key])
278- Mar 3
278+ Jan 1
279279 Feb 2
280- Aug 8
281- Sep 9
280+ Mar 3
282281 Apr 4
282+ May 5
283283 Jun 6
284284 Jul 7
285- Jan 1
286- May 5
285+ Aug 8
286+ Sep 9
287+ Oct 10
287288 Nov 11
288289 Dec 12
289- Oct 10
290290
291- Note that the order is essentially random, because it's based on the hash
292- ordering of the objects in the dictionary.
291+ Note that starting with Python 3.7, dictionary iteration order is guaranteed
292+ to be the same as the insertion order. In earlier versions, the behaviour was
293+ unspecified and could vary between implementations.
293294
294295Applying :func: `iter ` to a dictionary always loops over the keys, but
295296dictionaries have methods that return other iterators. If you want to iterate
@@ -301,8 +302,8 @@ The :func:`dict` constructor can accept an iterator that returns a finite stream
301302of ``(key, value) `` tuples:
302303
303304 >>> L = [(' Italy' , ' Rome' ), (' France' , ' Paris' ), (' US' , ' Washington DC' )]
304- >>> dict (iter (L)) # doctest: +SKIP
305- {'Italy': 'Rome', 'US ': 'Washington DC ', 'France ': 'Paris '}
305+ >>> dict (iter (L))
306+ {'Italy': 'Rome', 'France ': 'Paris ', 'US ': 'Washington DC '}
306307
307308Files also support iteration by calling the :meth: `~io.TextIOBase.readline `
308309method until there are no more lines in the file. This means you can read each
0 commit comments