[issue32720] Format mini-language integer definition is incorrect

Serhiy Storchaka report at bugs.python.org
Sun Feb 4 01:28:50 EST 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

What about arg_name and element_index?

>>> '{}'.format(123)
'123'
>>> '{0}'.format(123)
'123'
>>> '{0x0}'.format(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: '0x0'
>>> '{0_0}'.format(123)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: '0_0'
>>> '{0[0]}'.format([123])
'123'
>>> '{0[0x0]}'.format([123])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str
>>> '{0[0_0]}'.format([123])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32720>
_______________________________________


More information about the Python-bugs-list mailing list