[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-05-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +12965

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 85d83ec7c99727476c79feb5c34c65264a99144e by Raymond Hettinger 
(Amador Pahim) in branch 'master':
bpo-35864: fix namedtuple._asdict() docstring (GH-11720)
https://github.com/python/cpython/commit/85d83ec7c99727476c79feb5c34c65264a99144e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

FWIW, both PEP 468 (kwargs order) and PEP 520 (class definition order) specify 
order-preserving mapping rather than dict.  The main difference is that they 
are about language features rather than something out of the stdlib. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

If you prefer, I'd be glad to open separate issues for either thing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

Also, there's a potentially misleading detail that you might consider 
correcting in the text.  However, making it correct might make it slightly less 
clear, so it's a bit of a judgement call on how important it is to be explicit 
here.  (FWIW, I think it's worth it to some extent.)

The language reference doesn't guarantee that dictionaries are order-preserving 
(yet). [1]  Therefore there can be (are?) Python implementations where dict 
isn't ordered.  Users of those implementations may be confused by the docs (and 
docstring) saying the method returns a dict.

This could be addressed by changing those places to say something like it 
returns an insertion-ordered mapping.  The docs entry would also have an 
"CPython implementation detail" part saying it's actually a dict in CPython.

Since "insertion-ordered mapping" isn't nearly as clear as "dict" (even if more 
correct), it may make more sense to simply say "dict".  However, in that case 
I'd recommend at the very least to add a "CPython implementation detail" part 
to the docs entry which says in CPython it returns a dict, but in other 
implementations it may be some other order-preserving mapping.

Honestly, after having written that the latter option seems more sensible. :)


[1] https://docs.python.org/3.8/reference/datamodel.html#index-29

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

Thanks for doing this, Raymond!

FYI, I found a couple of places where it still refers to OrderedDict:

1. in the doc entry in collections.rst [1]
2. in the docstring [2]


[1] 
https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-a2f0632ea84b755c7ef5b9bd291c7fdfR890
[2] 
https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-8a750c700ae5ac1d0a14922de83e99ccR432

--
nosy: +eric.snow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +11589, 11590, 11592

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +11589

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +11589, 11590

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +11589, 11590, 11591, 11592

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-31 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0bb4bdf0d93b301407774c4ffd6df54cff947df8 by Raymond Hettinger in 
branch 'master':
bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)
https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch, patch, patch
pull_requests: +11564, 11565, 11566
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch, patch
pull_requests: +11564, 11565
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +11564
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-01-30 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Now that regular dicts are ordered and compact, it makes more sense for the 
_asdict() method to create a regular dict (as it did in its early days) rather 
than an OrderedDict.  The regular dict is much smaller, much faster, and has a 
much cleaner looking repr. 

Historically we would go through a deprecation period for a possibly breaking 
change; however, it was considered more benefit to users and less disruptive to 
make the update directly.  See the thread starting at: 
https://mail.python.org/pipermail/python-dev/2019-January/156150.html

--
assignee: rhettinger
components: Library (Lib)
messages: 334602
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Replace OrderedDict with regular dict in namedtuple's _asdict() method.
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com