Title: str.format() on negative floats
Type: Stage:
Components: Interpreter Core Versions: Python 3.0, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith, hagen
Priority: normal Keywords:

Created on 2008-07-18 20:09 by hagen, last changed 2008-07-19 00:34 by eric.smith. This issue is now closed.

Messages (2)
msg69988 - (view) Author: Hagen Fürstenau (hagen) Date: 2008-07-18 20:09
This happens with an empty type field in the format specification:

>>> "{0:1}".format(-1.23)

With type "g" it's ok:

>>> "{0:1g}".format(-1.23)
msg69998 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2008-07-19 00:34
Thanks for catching this.  I was not skipping the leading sign char when
looking for the decimal point in the string, which was causing me to
incorrectly determine that a decimal wasn't present.

Fixed in r65125 (trunk) and r65126 (py3k).
Date User Action Args
2008-07-19 00:34:32eric.smithsetstatus: open -> closed
resolution: fixed
messages: + msg69998
components: + Interpreter Core, - Library (Lib)
2008-07-18 20:53:39benjamin.petersonsetassignee: eric.smith
nosy: + eric.smith
2008-07-18 20:09:20hagencreate