[New-bugs-announce] [issue5965] Format Specs: doc 's' and implicit conversions

Terry J. Reedy report at bugs.python.org
Fri May 8 03:31:32 CEST 2009

New submission from Terry J. Reedy <tjreedy at udel.edu>:

String Services / Format Specification Mini-Language ( in 3.1)
Building on #5963: document type 's' and implicit conversions.

Near the top, after
"A general convention is that an empty format string ("") produces the
same result as if you had called str() on the value."
"A non-empty format string typically modifies that result."

[This applies to all formats but particularly explains the point of 's',
present or implied.]

In the grammar box, add '" s " |' to the front of the list of types.

After "Finally, the type determines how the data should be presented." add
"Non-number values require 's' or no type.  Numbers are not allowed with

At the very end, add

"If an integer is used with a non-integer number presentation type
(those above other than 'n' or none) it is converted with float(). 
However, using a float or decimal with an integer-only presentation type
is not allowed."

assignee: georg.brandl
components: Documentation
messages: 87421
nosy: georg.brandl, tjreedy
severity: normal
status: open
title: Format Specs: doc 's' and implicit conversions
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list