Message250253
Since 3.4.1, string.Formatter() accepts empty keys {}. If these are nested they give different results from explicitly numbered, where the same arguments applied "".format() give the expected results:
from string import Formatter
f = Formatter()
fmt0 = "X {:<{}} {} X"
fmt1 = "X {0:<{1}} {2} X"
for fmt in [fmt0, fmt1]:
x = f.format(fmt, 'ab', 5, 1)
y = fmt.format( 'ab', 5, 1)
print(x)
print(y)
gives:
X ab 5 X
X ab 1 X
X ab 1 X
X ab 1 X
of which the first line is incorrect. |
|
Date |
User |
Action |
Args |
2015-09-08 19:23:13 | anthon | set | recipients:
+ anthon |
2015-09-08 19:23:13 | anthon | set | messageid: <1441740193.79.0.679577096269.issue25034@psf.upfronthosting.co.za> |
2015-09-08 19:23:13 | anthon | link | issue25034 messages |
2015-09-08 19:23:13 | anthon | create | |
|