[issue35077] Make TypeError message less ambiguous

Terry J. Reedy report at bugs.python.org
Fri Oct 26 15:45:35 EDT 2018


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I checked a bit.  All the 'index' entries in the index are about sequences.  However, https://docs.python.org/3/reference/datamodel.html has this abstract (non-Python) description:

"Mappings
    These represent finite sets of objects indexed by arbitrary index sets. The subscript notation a[k] selects the item indexed by k from the mapping a; ...
    Dictionaries
        These represent finite sets of objects indexed by nearly arbitrary values."

I personally would prefer 'keyed' or 'subscripted' and 'key'to prevent confusion.  The entry then switches to the usual Python term 'key'.

"The only types of values not acceptable as keys  ... a key’s hash value ... used for keys ..."

https://docs.python.org/3/library/stdtypes.html#mapping-types-dict uses 'index' once as a verb, otherwise uses 'key'.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35077>
_______________________________________


More information about the Python-bugs-list mailing list