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: Built-in Formatter accepts undocumented presentation type
Type: Stage:
Components: Documentation, Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: eric.smith, georg.brandl, lrekucki
Priority: normal Keywords:

Created on 2010-01-06 00:32 by lrekucki, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg97284 - (view) Author: Łukasz Rekucki (lrekucki) Date: 2010-01-06 00:32
The documentation states: "Most built-in types implement the following options for format specifications, although some of the formatting options are only supported by the numeric types."

The list doesn't include "s" presentation type, which is actually accepted for most built-in types *except* numeric ones. So you can write:
>>> "{:s}".format([])"
'[]'

But with numeric types you have to explicitly convert:
>>> "{!s:s}".format(5)
'5'
>>> "{:s}".format(5) # fails
msg97285 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-01-06 01:00
This is a duplicate of issue 5965.
History
Date User Action Args
2022-04-11 14:56:56adminsetgithub: 51890
2010-01-06 01:00:15eric.smithsetstatus: open -> closed
resolution: duplicate
messages: + msg97285
2010-01-06 00:58:39eric.smithsetnosy: + eric.smith
2010-01-06 00:32:40lrekuckicreate