[issue13971] format() doesn't parse str.

2012-02-08 Thread Eric V. Smith
Eric V. Smith added the comment: This is working as defined in PEP 3101: it calls PySequence_GetItem() or PyObject_GetItem() on the value inside the brackets. There is indeed no item in d that is the string "0" (including the quotes). -- assignee: -> eric.smith resolution: -> invali

[issue13971] format() doesn't parse str.

2012-02-08 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue13971] format() doesn't parse str.

2012-02-08 Thread umedoblock
New submission from umedoblock : format() mis understaning. please pay attention to [0], [x]. >>> d = {0: "a", "0": "A"} >>> 'd[0] = {0[0]}'.format(d) 'd[0] = a' >>> 'd[0] = {0["0"]}'.format(d) Traceback (most recent call last): File "", line 1, in KeyError: '"0"' >>> d2 = {"x": 100} >>> 'd2[