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.

classification
Title: Misleading explanation of fill and align in format_spec
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: davidchambers, docs@python, eric.smith, ezio.melotti, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2013-10-12 22:27 by davidchambers, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue19238.diff ezio.melotti, 2013-10-20 23:35 review
Messages (9)
msg199633 - (view) Author: David Chambers (davidchambers) Date: 2013-10-12 22:27
From http://docs.python.org/3/library/string.html#formatspec:

> The presence of a fill character is signaled by the character
> following it, which must be one of the alignment options. If the
> second character of format_spec is not a valid alignment option,
> then it is assumed that both the fill character and the alignment
> option are absent.

The fact that the second character in the format_spec is not an
alignment option is not sufficient to declare that the alignment
option is absent: the alignment option may be the first character
in the format_spec. For example:

    >>> '{:^10}'.format(42)
    '    42    '

I suggest the following wording:

The presence of a fill character is signaled by the character
following it, which must be one of the alignment options. Unless
the second character of format_spec is a valid alignment option,
the fill character is assumed to be absent.
msg200332 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-10-18 23:36
See also issue 19289.
msg200652 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-10-20 23:35
Here's a patch.  This also include a fix for #19289.
msg200654 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2013-10-20 23:40
Looks good to me. Thanks!
msg200657 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-20 23:54
New changeset e3ff2065c548 by Ezio Melotti in branch '3.3':
#19238, #19289: fix description of the align and fill values of the format specification.
http://hg.python.org/cpython/rev/e3ff2065c548

New changeset f52892642c15 by Ezio Melotti in branch 'default':
#19238, #19289: merge with 3.3.
http://hg.python.org/cpython/rev/f52892642c15

New changeset 0592dc076bb7 by Ezio Melotti in branch '2.7':
#19238, #19289: fix description of the align and fill values of the format specification.
http://hg.python.org/cpython/rev/0592dc076bb7
msg200659 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-10-20 23:55
Fixed, thanks for the review!
msg202605 - (view) Author: David Chambers (davidchambers) Date: 2013-11-11 05:51
These commits contain a typo: s/preceeded/preceded/
msg203113 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-17 00:47
New changeset 2b0690c9a026 by Ezio Melotti in branch '2.7':
#19238: fix typo in documentation.
http://hg.python.org/cpython/rev/2b0690c9a026

New changeset 7e3f8026ed30 by Ezio Melotti in branch '3.3':
#19238: fix typo in documentation.
http://hg.python.org/cpython/rev/7e3f8026ed30

New changeset 829b95824867 by Ezio Melotti in branch 'default':
#19238: merge with 3.3.
http://hg.python.org/cpython/rev/829b95824867
msg203114 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-11-17 00:48
Fixed, thanks for noticing!
History
Date User Action Args
2022-04-11 14:57:51adminsetgithub: 63437
2013-11-17 00:48:33ezio.melottisetmessages: + msg203114
2013-11-17 00:47:51python-devsetmessages: + msg203113
2013-11-11 05:51:38davidchamberssetmessages: + msg202605
2013-10-20 23:55:27ezio.melottisetstatus: open -> closed
messages: + msg200659

assignee: docs@python -> ezio.melotti
resolution: fixed
stage: patch review -> resolved
2013-10-20 23:54:33python-devsetnosy: + python-dev
messages: + msg200657
2013-10-20 23:40:30eric.smithsetmessages: + msg200654
2013-10-20 23:35:34ezio.melottisetfiles: + issue19238.diff
keywords: + patch
messages: + msg200652

stage: patch review
2013-10-19 05:15:46ezio.melottisetnosy: + ezio.melotti
type: enhancement
2013-10-18 23:36:35eric.smithsetmessages: + msg200332
2013-10-18 23:07:17terry.reedysetnosy: + terry.reedy

versions: + Python 2.7, Python 3.3, Python 3.4
2013-10-12 23:31:20ned.deilysetnosy: + eric.smith
2013-10-12 22:27:49davidchamberscreate