New submission from Semyon <simeon+...@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':
print(ctx.items())
```

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@python
components: Documentation
messages: 350129
nosy: MarSoft, docs@python
priority: normal
severity: normal
status: open
title: Minor error in PEP567 code example
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37911>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to