[Python-bugs-list] [ python-Bugs-791397 ] Tutorial: mutable objects may be keys

SourceForge.net noreply at sourceforge.net
Tue Aug 19 12:04:07 EDT 2003


Bugs item #791397, was opened at 2003-08-19 14:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=791397&group_id=5470

Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Victor (brianhv)
Assigned to: Nobody/Anonymous (nobody)
Summary: Tutorial: mutable objects may be keys

Initial Comment:
http://python.org/doc/tut/node7.html#SECTION007400000000000000000

The tutorial section 5.4 ("Dictionaries") says, "Unlike
sequences, which are indexed by a range of numbers,
dictionaries are indexed by keys, which can be any
immutable type; strings and numbers can always be
keys."  This strongly implies that only immutable
objects may be keys, and I always assumed that to be
the case.  I have recently learned that is not true.

I would suggest a change along the lines of "which can
be any immutable type or mutuable types under some
circumstances," with a link to further elaboration on
what is required for a type to be hashable.

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

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



More information about the Python-bugs-list mailing list