This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Format Specification Mini-Language missing type 'i'?
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3, Python 2.7, Python 2.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: anacrolix, eric.smith, georg.brandl
Priority: normal Keywords:

Created on 2011-02-21 04:21 by anacrolix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg128934 - (view) Author: Matt Joiner (anacrolix) Date: 2011-02-21 04:21
The Format Specification Mini-Language is missing type 'i', generally the same as 'd', and ubiquitous in the libraries from which the specification is derived. See the 'd,i' conversion specifier in C: http://linux.die.net/man/3/printf, and the Old String Formatting Operations: http://docs.python.org/dev/py3k/library/stdtypes.html#old-string-formatting-operations.

>>> '{:d}'.format(3)
'3'
>>> '{:i}'.format(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Unknown format code 'i' for object of type 'int'
msg128943 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-02-21 06:55
IMO the new format language was quite right to do away with redundant specifiers, since "d" and "i" are completely equivalent.
msg128948 - (view) Author: Matt Joiner (anacrolix) Date: 2011-02-21 09:08
Is there any reason 'd' was chosen over 'i'? Is there a more appropriate place I can find this out?
msg128956 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2011-02-21 11:24
It would be redundant, so we don't need both. I don't recall any discussion when PEP 3101 was developed as to choosing 'd' over 'i'. In all of the C code I've seen use printf, I don't think I've ever seen 'i' used.
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55473
2011-02-21 11:24:14eric.smithsetstatus: open -> closed
type: enhancement
messages: + msg128956

resolution: rejected
stage: resolved
2011-02-21 09:08:23anacrolixsetmessages: + msg128948
2011-02-21 06:55:54georg.brandlsetassignee: eric.smith

messages: + msg128943
nosy: + georg.brandl, eric.smith
2011-02-21 04:21:10anacrolixcreate