[New-bugs-announce] [issue7641] Built-in Formatter accepts undocumented presentation type

Łukasz Rekucki report at bugs.python.org
Wed Jan 6 01:32:42 CET 2010


New submission from Łukasz Rekucki <lrekucki at gmail.com>:

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

----------
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 97284
nosy: georg.brandl, lrekucki
severity: normal
status: open
title: Built-in Formatter accepts undocumented presentation type
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7641>
_______________________________________


More information about the New-bugs-announce mailing list