[Tutor] Why is an OrderedDict not sliceable?
Ben Finney
ben+python at benfinney.id.au
Thu Jan 21 12:00:10 EST 2016
Oscar Benjamin <oscar.j.benjamin at 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.
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.
So accessing an item in a mapping by key is not indexed access.
--
\ “When we pray to God we must be seeking nothing — nothing.” |
`\ —Francis of Assisi |
_o__) |
Ben Finney
More information about the Tutor
mailing list