Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-29453: Remove reference to undefined dictionary ordering in Tutorial
As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that
ordering is undefined and change snippet to remove the unecessary sorted call.
  • Loading branch information
DimitrisJim committed Feb 16, 2017
commit 2b7cd229c85c656c4cd2e973325167d8e2fceedd
8 changes: 2 additions & 6 deletions Doc/tutorial/controlflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,7 @@ function like this::
for arg in arguments:
print(arg)
print("-" * 40)
keys = sorted(keywords.keys())
for kw in keys:
for kw in keywords:
print(kw, ":", keywords[kw])

It could be called like this::
Expand All @@ -513,13 +512,10 @@ and of course it would print:
It's very runny, sir.
It's really very, VERY runny, sir.
----------------------------------------
client : John Cleese
shopkeeper : Michael Palin
client : John Cleese
sketch : Cheese Shop Sketch

Note that the list of keyword argument names is created by sorting the result
of the keywords dictionary's ``keys()`` method before printing its contents;
if this is not done, the order in which the arguments are printed is undefined.

.. _tut-arbitraryargs:

Expand Down