[Tutor] Enumerate vs DictReader object manipulation:

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Feb 4 04:46:41 EST 2016


On 4 February 2016 at 03:21, Ben Finney <ben+python at benfinney.id.au> wrote:
> Alex Kleider <akleider at sonic.net> writes:
>
>> How does a dict fit into this scheme?
>> Is it a sequence?
>
> No, a dict is not a sequence. But it is a container: all its items
> remain available and can be retrieved again and again, and you can
> interrogate whether a value is one of the items in that container.
>
> An instance of the built-in ‘set’ type is also a container and not a
> sequence.
>
> Containers are iterable too.

You can see an explanation of the different collection terminology here:
https://docs.python.org/2/library/collections.html#collections-abstract-base-classes

A dict is a Mapping and a set is a Set. Both also comes under the
categories Sized, Iterable, and Container.

--
Oscar


More information about the Tutor mailing list