New submission from Aschwin <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue44496>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com