Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tutorial on dictionaries has error in example #76308

Closed
tberla mannequin opened this issue Nov 24, 2017 · 4 comments
Closed

tutorial on dictionaries has error in example #76308

tberla mannequin opened this issue Nov 24, 2017 · 4 comments
Labels
docs Documentation in the Doc dir

Comments

@tberla
Copy link
Mannequin

tberla mannequin commented Nov 24, 2017

BPO 32127
Nosy @ericvsmith

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-11-24.19:25:53.680>
created_at = <Date 2017-11-24.19:14:29.532>
labels = ['invalid', 'docs']
title = 'tutorial on dictionaries has error in example'
updated_at = <Date 2017-11-25.01:42:56.088>
user = 'https://bugs.python.org/tberla'

bugs.python.org fields:

activity = <Date 2017-11-25.01:42:56.088>
actor = 'eric.smith'
assignee = 'docs@python'
closed = True
closed_date = <Date 2017-11-24.19:25:53.680>
closer = 'tberla'
components = ['Documentation']
creation = <Date 2017-11-24.19:14:29.532>
creator = 'tberla'
dependencies = []
files = []
hgrepos = []
issue_num = 32127
keywords = []
message_count = 4.0
messages = ['306913', '306914', '306915', '306932']
nosy_count = 3.0
nosy_names = ['eric.smith', 'docs@python', 'tberla']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue32127'
versions = ['Python 3.6']

@tberla
Copy link
Mannequin Author

tberla mannequin commented Nov 24, 2017

in https://docs.python.org/3/tutorial/datastructures.html:

-----
5.5. Dictionaries
...
Here is a small example using a dictionary:

>>>
>>> tel = {'jack': 4098, 'sape': 4139}
>>> tel['guido'] = 4127
>>> tel
{'sape': 4139, 'guido': 4127, 'jack': 4098}

I think the order of dictionary elements shown after 'guido' is inserted is wrong.

The correct order is:
{'jack': 4098, 'sape': 4139, 'guido': 4127}

@tberla tberla mannequin assigned docspython Nov 24, 2017
@tberla tberla mannequin added the docs Documentation in the Doc dir label Nov 24, 2017
@ericvsmith
Copy link
Member

dict makes no guarantees on ordering, so I think the example is fine. There is no "correct" ordering.

@tberla
Copy link
Mannequin Author

tberla mannequin commented Nov 24, 2017

Thanks, Eric. (I'm new to Python.) Perhaps I should have paid closer attention to the description of the dictionary data structure --

"Performing list(d.keys()) on a dictionary returns a list of all the keys used in the dictionary, in arbitrary order"

-- rather than just jumping ahead to the code example. ;-)

@tberla tberla mannequin closed this as completed Nov 24, 2017
@tberla tberla mannequin added the invalid label Nov 24, 2017
@ericvsmith
Copy link
Member

No problem. Welcome to Python!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

1 participant