You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's straightforward if you consider the implementation of the
requirement that %% renders a single percent sign: the second % is
parsed just like any other formatting code (i, d, f, etc.) and the stuff
between the first % and the formatting code is treated completely uniformly.
It's straightforward if you consider the implementation of the
requirement that %% renders a single percent sign: the second % is
parsed just like any other formatting code (i, d, f, etc.) and the stuff
between the first % and the formatting code is treated completely
uniformly.
----------
nosy: +gvanrossum
resolution: -> rejected
status: open -> closed
I'd rather see it this way: It is a programming error if a format string
contains a reference to a nonexisting dictionary key, no matter what
formatting specifier is used. The implementation is quite consistent here.
Activity
blopblopy commentedon Aug 7, 2008
this is counter intuitive and cannot be deduced from the documentation.
gvanrossum commentedon Aug 7, 2008
It's straightforward if you consider the implementation of the
requirement that %% renders a single percent sign: the second % is
parsed just like any other formatting code (i, d, f, etc.) and the stuff
between the first % and the formatting code is treated completely uniformly.
blopblopy commentedon Aug 7, 2008
The main problem with this is that the following code does not make any
sense:
"%(a)%" % dict(a=3)
It has no semantic meaning (take the dictionary paramater a, and do nothing
with it).
It must be a user bug (except in very wierd cases).
I agree that when I consider the implementaion, it makes sense, but as a
python user, this behavior is really non-intuitive.
2008/8/7 Guido van Rossum <report@bugs.python.org>
birkenfeld commentedon Aug 7, 2008
I'd rather see it this way: It is a programming error if a format string
contains a reference to a nonexisting dictionary key, no matter what
formatting specifier is used. The implementation is quite consistent here.