Magnitude and ProtoMagnitude ABCs — primarily for argument validation
Andrew Barnert via Pythonideas 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 Booleanvalues)? I've had occasion (a class for outcomes in twoplayer 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. ;)
participants (1)

kana70416＠gmail.com