Andrew Barnert via Python-ideas writes:
> Is there any commonly used or even imaginable useful type that uses
> them in weirder ways than set and float (which are both partially
> ordered) or np.array (where they aren’t even Boolean-values)?
I've had occasion (a class for outcomes in two-player games) to define
both < and <= as complete preorders, with "symmetry" in the sense that
A < B iff B > A and A <= B iff B >= A, but < and <= were completely
independent: they could be identical ("game of pure coordination"),
they could be inverse ("game of pure competition"), and they could be
anything else (eg, "prisoners' dilemma"). This system took a little
getting used to, but writing "A > B and A >= B and A != B" [1] to
implement "A Pareto dominates B" was one expressive convenience among
others.
I'm not sure this is "weird" in the sense you mean, and I greatly
doubt this is sufficiently common to deserve an ABC :-), but it's a
real example (long since archived on a disc whose exact location has
slipped from memory ;-) that shows how flexible "ordering" in Python
can be.
Footnotes:
[1] How the class, and specifically "A != B", were implemented is
left for the reader who knows game theory to imagine. ;-)
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/772IG26DKONSV5WHCNSGWCF2OUFNXLQK/
Code of Conduct: http://python.org/psf/codeofconduct/