[ python-Bugs-1612113 ] Dictionary ordering docs are too unclear of dangers

SourceForge.net noreply at sourceforge.net
Sat Dec 9 15:31:26 CET 2006


Bugs item #1612113, was opened at 2006-12-09 12:57
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1612113&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
>Status: Pending
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: Dictionary ordering docs are too unclear of dangers

Initial Comment:
The footnote #3 on this page of the documentation details some thoughts on the order of dictionaries and the results of the different key and value retreival methods. I think it promises more than it should. The current content tells the reader they can expect consistant results from a dictionary as far as order goes, and we know this to be simply untrue and even in the circumstances where its likely (but still not impossible), such as `zip(d.values(), d.keys())` there is not even any compelling reason to use such odd methods, making the very fact that the idea is documented suspect.

I recommend the footnote be removed entirely, or replaced with "Keys and values are listed in an arbitrary order which is non-random, varies across Python implementations, and depends on the dictionary's history of insertions and deletions. Do not expect anything of the order of the items(), keys(), values(), iteritems(), iterkeys(), and itervalues() methods' results." 


Page in question:
http://docs.python.org/lib/typesmapping.html

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-12-09 15:31

Message:
Logged In: YES 
user_id=21627
Originator: NO

You seem to be saying (without actually saying it) that the footnote is
untrue. Can you give an example that demonstrates it is untrue?

I believe the footnote is correct, precise, and complete as it stands, and
fail to see a bug here.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1612113&group_id=5470


More information about the Python-bugs-list mailing list