New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string formatting quirk using %.% #47766
Comments
>>> "%.%s" % ()
'%s'
>>> "%(a).%(b)s" % dict(a=2)
'%(b)s'
>>> "%(a).%(b)s" % dict(a=2, b=3)
'%(b)s'
>>> "%(a).%(b)s" % dict()
Traceback (most recent call last):
File "<pyshell#6>", line 1, in -toplevel-
"%(a).%(b)s" % dict()
KeyError: 'a' this is counter intuitive and cannot be deduced from the documentation. |
It's straightforward if you consider the implementation of the |
The main problem with this is that the following code does not make any It has no semantic meaning (take the dictionary paramater a, and do nothing I agree that when I consider the implementaion, it makes sense, but as a 2008/8/7 Guido van Rossum <report@bugs.python.org>
|
I'd rather see it this way: It is a programming error if a format string |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: