Created on 2008-04-08 19:38 by dangyogi, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (5) |
|
|
msg65209 - (view) |
Author: Bruce Frederiksen (dangyogi) |
Date: 2008-04-08 19:38 |
Format strings are documented to only allow identifiers or integers as the field_name, but allow almost anything. Python 3.0a3 |
|
|
msg65265 - (view) |
Author: Alexander Belopolsky (belopolsky) *  |
Date: 2008-04-09 21:23 |
This is a feature explained in PEP 3101: """ Implementation note: The implementation of this proposal is not required to enforce the rule about a simple or dotted name being a valid Python identifier. Instead, it will rely on the getattr function of the underlying object to throw an exception if the identifier is not legal. The str.format() function will have a minimalist parser which only attempts to figure out when it is "done" with an identifier (by finding a '.' or a ']', or '}', etc.). """ <http://www.python.org/dev/peps/pep-3101> Why is that a problem for you? |
|
|
msg65404 - (view) |
Author: Bruce Frederiksen (dangyogi) |
Date: 2008-04-12 16:38 |
I was reading the 3.0 documentation: http://docs.python.org/dev/3.0/library/string.html#formatstrings which indicated that an identifier was required. I was unaware of the implementation note in the PEP. They only issue remaining is that for the example in the title of this issue, "{ +(}".format(**{' +(': 44}), no error is generated. I agree that this is a nit and presumably the will of the community reviewing the PEP, so agree to having the issue rejected. I would reject it myself, but am unable to do so... Thank you for pointing out the PEP to me. |
|
|
msg67122 - (view) |
Author: Eric V. Smith (eric.smith) *  |
Date: 2008-05-20 11:34 |
After discussing this with Talin, we've decided this is "works as designed". The problem, if any, is that **{' +(': 44} is allowed as a parameter. I think that perhaps that should be an error, but I haven't had time to research if this is already a known issue. |
|
|
msg67123 - (view) |
Author: Eric V. Smith (eric.smith) *  |
Date: 2008-05-20 11:41 |
I should have been clearer. By "The problem, if any, is that **{' +(': 44} is allowed as a parameter", I meant in general, for all function/method calls. It's not an issue that's restricted to str.format(). |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:33 |
admin |
set |
github: 46850 |
2008-05-20 11:41:57 |
eric.smith |
set |
messages: + |
2008-05-20 11:35:57 |
eric.smith |
set |
status: open -> closedresolution: rejectedmessages: + |
2008-05-06 13:21:20 |
eric.smith |
set |
assignee: eric.smithnosy: + eric.smith |
2008-04-12 16:38:36 |
dangyogi |
set |
messages: + |
2008-04-09 21:23:35 |
belopolsky |
set |
nosy: + belopolskymessages: + |
2008-04-08 19:38:42 |
dangyogi |
create |
|