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

Stephen J. Turnbull stephen at xemacs.org
Wed Oct 8 09:31:17 CEST 2014


Ed Kellett writes:
 > On 8 October 2014 05:37, Stephen J. Turnbull <stephen at xemacs.org> wrote:
 > > random832 at fastmail.us writes:
 > >
 > >  > This has nothing to do with comparable types
 > >
 > > "if ordering is the same" is what you wrote.  How do you propose to
 > > determine that without an OrderRelation type or similar?
 > >
 > 
 > If the order of the elements in the ordered container is the same -
 > which is easy to test for. In the interest of being exactly clear,
 > here's some code that does so

Well, sure, if it's computable you can write Python code to do it.  My
point is that isinstance.(collections.Ordered) isn't enough.  You must
do additional work (worst case O(N) for the largest possible N =
#superset) or put additional information into the type.

I just don't see much valued added in this ABC or whatever is being
proposed for addition to the stdlib.


More information about the Python-ideas mailing list