[Python-ideas] Adding collections.abc.Ordered

Stephen J. Turnbull stephen at xemacs.org
Sun Nov 8 07:34:37 EST 2015


Andrew Barnert writes:

 > Not very useful, sure—I argued that myself—but how is it
 > dangerous? The only risk here is the risk that comes from adding
 > more code, docs, and complexity to the stdlib.

This proposal requires that users not only read the docs in the
stdlib, but also the docs of each class, perhaps each object, using
the functionality.  Asking users to read docs thoroughly is a recipe
for bugs, especially since the order used is likely to be documented
as "the natural order", and people will have different ideas about
that.  This is the "complication" the Zen warns about, as well as
being "implicit".  You may not consider that dangerous, but I do.

And on top of that, not only doesn't it provide any guarantees, you've
pretty much convinced me it's impossible to do so.  If that's not an
attractive nuisance, what is?

 > But, most importantly, if you want an index method, why aren't you
 > just requiring Sequence, which has one?

Because "ordered sets" and "ordered dicts" aren't Sequences.

But don't ask me, ask the OP.  As I wrote earlier, no use case for
set- or dict-valued __slots__ has been given.  I have nothing invested
in anything I wrote except that.  I'm happy to concede that everything
else I wrote was boneheaded, retract it, and apologize for wasting
your time.



More information about the Python-ideas mailing list