New submission from Terry J. Reedy <tjre...@udel.edu>:

String Services / Format Specification Mini-Language (7.1.3.1 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."
add
"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
's'.

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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to