New submission from Łukasz Rekucki <[email protected]>:
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 <[email protected]>
<http://bugs.python.org/issue7641>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com