[issue24965] Implement PEP 498: Literal String Formatting

Jelle Zijlstra report at bugs.python.org
Sun Sep 13 02:15:37 CEST 2015


Jelle Zijlstra added the comment:

Is this behavior intentional?

>>> str = len
>>> x = 'foo'
>>> f'{x!s}'
'3'
>>> '{!s}'.format(x)
'foo'

Or similarly:

>>> import builtins
>>> del builtins.repr
>>> f'{x!r}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'repr' is not defined

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24965>
_______________________________________


More information about the Python-bugs-list mailing list