Skip to content

Python tutorial section 5.5 "It is an error to extract a value using a non-existent key." #116488

@Dan-at-56

Description

@Dan-at-56

Documentation

I am a beginner in Python and also on GitHub - my apologies in advance if this is a dumb suggestion or made inappropriately...

In the Python tutorial section 5.5 on dictionaries it says: "It is an error to extract a value using a non-existent key."
However, a quick test shows that an error is not generated. Rather, the value None is returned. Should the documentation be amended to that effect?

Python 3.12.2 (tags/v3.12.2:6abddd9, Feb  6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)] on win32
>>> my_dict = {'a': 1, 'b': 2, 'c': 3}
>>> value = my_dict.get('d')
>>> print(value)
None

Thanks,
Dan

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions