This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Inconsistent PEP 0448 implementation
Type: behavior Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, python-dev, veky
Priority: normal Keywords:

Created on 2015-07-05 13:05 by veky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg246312 - (view) Author: Vedran Čačić (veky) * Date: 2015-07-05 13:05
It seems the consequences of PEP 0448 weren't really thought through. :-/ (And BTW why isn't it in "What's new in Python 3.5"? I know there is a file with full details, but I guess this really should be notable enough.)

    {0:1, **{0:2}, 0:3, 0:4}

Do you know what is the value of that dict? And does it make sense to you? It surely doesn't make sense to me (though I understand the implementation). I know things are really subtle and even Guido gets it wrong (https://bugs.python.org/msg234413), even without PEP 0448, but this particular instance is horrible.

ValueError would be perfect, I'd be ok with 4, I'd shrug on 1, I'd frown on 2, but I _scream_ on 3. Please fix this until it's too late and fictional "backward compatibility" starts to freeze the wrong behaviour.
msg246319 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-05 15:39
New changeset a4df0fe62b46 by Benjamin Peterson in branch '3.5':
set items in dict displays from left to right (closes #24569)
https://hg.python.org/cpython/rev/a4df0fe62b46

New changeset 75852d90c225 by Benjamin Peterson in branch 'default':
merge 3.5 (#24569)
https://hg.python.org/cpython/rev/75852d90c225
msg246322 - (view) Author: Vedran Čačić (veky) * Date: 2015-07-05 15:49
Benjamin, you're my hero. :-)

I'm not really at home in C source... is it possible that you have also changed

    {0:1, 0:2}

to be {0:2} (as opposed to {0:1} as it is now)? I'm completely fine with that and find it more logical (and as I said in the previous message, it matches BDFL's mental model, which is the real reference implementation of Python:), but I'm afraid backward compatibility zealots will ruin the fun.
msg246323 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2015-07-05 15:53
Python 3.3.5 (default, Aug 19 2014, 23:45:33) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> {0:1, 0:2}
{0: 2}

Python 2.7.9 (default, Dec 24 2014, 23:52:11) 
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> {0:1, 0:2}
{0: 2}
msg246324 - (view) Author: Vedran Čačić (veky) * Date: 2015-07-05 16:35
Ah, so it was broken _only_ on 3.5. That should teach me not to uninstall Py3.x as soon as Py3.x+1 comes out. :-)

Ok, thank you very much.
History
Date User Action Args
2022-04-11 14:58:18adminsetgithub: 68757
2015-07-05 16:35:23vekysetmessages: + msg246324
2015-07-05 15:53:31benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg246323
2015-07-05 15:49:53vekysetmessages: + msg246322
2015-07-05 15:39:29python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg246319

resolution: fixed
stage: resolved
2015-07-05 13:11:10vekysettype: behavior
versions: + Python 3.5
2015-07-05 13:05:43vekycreate