[docs] [issue37911] Minor error in PEP567 code example

Semyon report at bugs.python.org
Wed Aug 21 19:01:15 EDT 2019

New submission from Semyon <simeon+bpo at maryasin.name>:

In PEP-567 there is a code example in `contextvars.Context` section (https://www.python.org/dev/peps/pep-0567/#contextvars-context):

# Print all context variables and their values in 'ctx':

But `ctx.items()` doesn't return a list of tuples as probably expected by this code; instead it returns a `items` object which, unlike `dict_items`, does not contain any sensible `repr` or `str`. So this print statement will output something like `<items at 0x7f7fbd91e468>`.

I think this code example should be chaned to something like `print(list(ctx.items()))`.

assignee: docs at python
components: Documentation
messages: 350129
nosy: MarSoft, docs at python
priority: normal
severity: normal
status: open
title: Minor error in PEP567 code example
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the docs mailing list