[New-bugs-announce] [issue46087] Zip library documentation error

Arthur Milchior report at bugs.python.org
Wed Dec 15 12:48:58 EST 2021


New submission from Arthur Milchior <arthur at milchior.fr>:

I don't have permission to assign the issue, but I intend to post the change in a few minutes as a PR

Copied from Richard Hyde's email to doc mailing list.

One of the examples of string formatting doesn't work. This applies to prior versions of Python as well.

The last set of the examples headed: 'Nesting arguments and more complex examples:' starts with the following code:

>>> for align, text in zip('<^>', ['left', 'center', 'right']):
...     '{0:{fill}{align}16}'.format(text, fill=align, align=align)
...

This omits print()
The correct code would be:

>>> for align, text in zip('<^>', ['left', 'center', 'right']):
...     print('{0:{fill}{align}16}'.format(text, fill=align, align=align))
...



-----------------------------------------------

I agree with Richard here that there is a problem. Most example don't use print, but since there is no returned expression, that's the most relevant way to express the meaning of the example. Adding an expression would just make things more complex.

Bug introducde in 28fbea412819f90698527c1997ece5aeddf8e9a7 in 2010.

----------
assignee: docs at python
components: Documentation
messages: 408624
nosy: Arthur-Milchior, docs at python
priority: normal
severity: normal
status: open
title: Zip library documentation error
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46087>
_______________________________________


More information about the New-bugs-announce mailing list