<p dir="ltr"><br>
On 8 Oct 2014 14:09, "Guido van Rossum" <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
><br>
> On Tue, Oct 7, 2014 at 8:54 PM, <<a href="mailto:random832@fastmail.us">random832@fastmail.us</a>> wrote:<br>
>><br>
>> On Tue, Oct 7, 2014, at 21:09, Stephen J. Turnbull wrote:<br>
>> > But this requires a comparison of the two orders, and "ordering<br>
>> > relation" is not a type available in the stdlib.<br>
>><br>
>> This has nothing to do with comparable types - the only comparison being<br>
>> done on the members themselves is equality.<br>
>><br>
>> i.e. if the main sequence is [5, 1, 3, 2, 4], it's true for [5, 2, 4]<br>
>> but not [5, 4, 1].<br>
>><br>
>> Think of it as being the question of whether "51234" matches "5.*2.*4"<br>
>> (it does) or "5.*4.*1" (it does not). But if the argument is a set<br>
>> instead he wants it to be whether it's a subset rather than a<br>
>> subsequence.<br>
><br>
><br>
> This is the first understandable description of Ram's use case that I have seen. Thank you!</p>
<p dir="ltr">And now that I also understand it, I can note that this kind of thing *does* occasionally come up in testing polymorphic filtering operations. If the original container has a non-arbitrary ordering, the filtering operation should preserve it. If the container ordering is arbitrary (e.g. set, dict) then filtering may also change the relative ordering of the retained elements. </p>
<p dir="ltr">That observation also gives a possible concrete semantic definition as to what "Ordered" might mean: adding or removing a new element never changes the relative ordering of the other elements in the container.</p>
<p dir="ltr">Under that definition, set and dict aren't ordered, since the order of iteration can be affected by the current number of items in the container.</p>
<p dir="ltr">As an example of the difference mattering in practice, "assertSameElements" is specifically designed to help deal with cases where you're comparing an unordered result to ordered reference data.</p>
<p dir="ltr">Cheers,<br>
Nick.</p>
<p dir="ltr">><br>
> --<br>
> --Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)<br>
><br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a></p>