[Python-ideas] issubclass(collections.OrderedDict, collections.Sequence)

Andrew Barnert abarnert at yahoo.com
Mon Oct 6 04:21:32 CEST 2014


On Oct 5, 2014, at 15:05, Ed Kellett <edk141 at gmail.com> wrote:

> I think the definition of ordered here would be that the container's
> iteration order carries any meaning (compare: dicts and sets' having
> iteration order is an incidental effect of one thing having to be
> iterated out first, and one shouldn't depend on that order; lists and
> ordereddicts' having iteration order is deliberate).

So this also implies that your favorite sorted dict class would also be Ordered. And that all of the views of OrderedDict (and SortedDict and rbtree and so on) would also be Ordered.

But I'm not sure what exactly you can do with that either... (Having the values view of an ordered or sorted dict be a Sequence, I can sort of imagine a use case for, but just an Ordered Container MappingView, I don't know.)


More information about the Python-ideas mailing list