Ben Finney <ben+pyt...@benfinney.id.au> writes:

> Oscar Benjamin <oscar.j.benja...@gmail.com> writes:
>
> > According to a narrow definition of indexed access. I would say that
> > d[k] is index access even if d is a dict and k a key.

The sense of “index” implied is used consistently throughout Python
<URL:https://docs.python.org/3/glossary.html> to refer to the integer
ordinal position in a sequence.

It is not compatible with key access into a mapping.

> An index implies the ordinal position in a sequence. In a mapping, the
> key is *not* referring to the position in a sequence, so is not a key.

“the key … is not an index”, I mean.

> So accessing an item in a mapping by key is not indexed access.

-- 
 \     “Facts do not cease to exist because they are ignored.” —Aldous |
  `\                                                            Huxley |
_o__)                                                                  |
Ben Finney

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to