classification
Title: Minor error in PEP567 code example
Type: Stage:
Components: Documentation Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: MarSoft, docs@python, xtreak
Priority: normal Keywords:

Created on 2019-08-21 23:01 by MarSoft, last changed 2019-08-22 01:34 by xtreak.

Messages (2)
msg350129 - (view) Author: Semyon (MarSoft) Date: 2019-08-21 23:01
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()))`.
msg350151 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2019-08-22 01:34
PEPs have their own GitHub issue tracker though I am not sure of edits to this PEP.
 GitHub : https://github.com/python/peps/issues . This can be closed as third party.
History
Date User Action Args
2019-08-22 01:34:49xtreaksetnosy: + xtreak
messages: + msg350151
2019-08-21 23:01:15MarSoftcreate