This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arthur-Milchior
Recipients Arthur-Milchior, docs@python
Date 2021-12-15.17:48:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639590538.75.0.882210215696.issue46087@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-12-15 17:48:58Arthur-Milchiorsetrecipients: + Arthur-Milchior, docs@python
2021-12-15 17:48:58Arthur-Milchiorsetmessageid: <1639590538.75.0.882210215696.issue46087@roundup.psfhosted.org>
2021-12-15 17:48:58Arthur-Milchiorlinkissue46087 messages
2021-12-15 17:48:58Arthur-Milchiorcreate