[New-bugs-announce] [issue44496] string.Formatter class not allowing {.field}
Aschwin
report at bugs.python.org
Wed Jun 23 03:26:04 EDT 2021
New submission from Aschwin <aschwin at vanderwoude.info>:
I expected the custom Formatter to behave the same as the normal "".format() function, but unnamed args or not supported.
Below is an example, which fails at a KeyError.
from string import Formatter
class test():
def __init__(self):
self.msg = "OK"
t = test()
print("Normal format() is {.msg}".format(t))
f = Formatter()
print(f.format("Formatter.format() is {.msg}", t))
----------
components: Library (Lib)
messages: 396383
nosy: avdwoude
priority: normal
severity: normal
status: open
title: string.Formatter class not allowing {.field}
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44496>
_______________________________________
More information about the New-bugs-announce
mailing list