Steve Jorgensen wrote:
> Chris Angelico wrote:
> > On Wed, Mar 4, 2020 at 6:04 PM Steve Jorgensen
> > ste...@stevej.name wrote:
> >  <snip>
> > https://en.wikipedia.org/wiki/Partially_ordered_set
> > "Partially ordered" means you can compare pairs of elements and find
> > which one comes first. "Totally ordered" means you can compare ANY
> > pair of elements, and you'll always know which comes first.
> > ChrisA
> > Ah. Good to know. I don't think "Partially ordered" actually applies, then,
> because that still seems to imply that transitivity would apply to 
> comparisons between any
> given pair of objects. Simply having implementations of all the rich 
> comparison operators
> does not make that true, however, and in particular, that's not true for sets.
> If we consider just the sets {1, 2} and {1, 3}, …
> In [1]: {1, 2} < {1, 3}
> Out[1]: False
> 
> In [2]: {1, 2} >= {1, 3}
> Out[2]: False
> 
> Neither is a subset of the other, so both of those tests return
> False.

Ah. Maybe I'm arguing against a different point than what you were making then. 
Just because sets are not partially ordered does not mean that "partially 
ordered" is not a useful distinction in addition to "totally ordered".

In that case, maybe the hierarchy would be something like…
* ProtoOrdered (or ProtoOrderable): Orderability is explicit and never 
inferred. Unordered unless also a subclass of PartiallyOrdered or 
TotallyOrdered.
* * PartiallyOrdered
* * * TotallyOrdered

An class that does not directly or virtually subclass any of those but 
implements all the rich comparison operators would be treated as an inferred 
virtual subclass of `TotallyOrdered`.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/7FV27SQYFR6M66JHHYMFW7EDKHXNJ3MJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to