On Sat, Sep 12, 2015 at 1:20 AM, Terry Reedy <tjreedy@udel.edu> wrote:
A mathematician has no problem with 'a'+'b' != 'b'+'a'.
I doubt it. A binary operation denoted + (and called addition) is almost universally a commutative operation. A non-commutative binary operation is usually denoted * (and called multiplication).
After closure,
Do you refer to "set closure" operation [1] here? I am not sure why it is relevant nor why it is "basic."
associativity is the most 'basic' operation, but non-associative operations are studied.
I think you have missed the words "property of" before "operation" above. "Closure", "commutativity", "associativity", etc. are properties of operations, not operations.
The equality relation, mapping pairs of members of a set to True or False is a different matter. Being an equivalence relation is fundamental to both normal logic, algebraic proofs, and the definition of sets.
Agree, and we have a solution for PEP 495 which preserves == as and equivalence (symmetric, reflexive and transitive) relationship.
Datetime members, are rather unusual beasts. They are triples consisting of a member of a discrete sequence (with some odd gaps),
I assume you are using a word "member" to refer to class instances. There are no gaps in datetimes: there are instances that don't correspond to any valid local time and (pre-PEP 495) there are local times that don't correspond to any instances with a given tzinfo. The unrepresentable times can still be represented using a different tzinfo. PEP 495 adds a way to represent all times using instances with any tzinfo, but on the flip side adds many more instances that are not "canonical" representations (e.g. fold=1 instances for regular times.)
a tz tag, and a 0/1 fold tag. The tz tags divide datetimes into equivalence classes.
That I don't understand. Local t and u = t.astimezone(UTC) are equal (t == u evaluates to True), so u and t belong to the same equivalence class.
The '-' operation is also unusual in being defined differently for pairs in the same or different equivalence classes.
I am not concerned about '-'. My main concern is about order operations. I am happy with the solution I have for ==, but I am still struggling with the non-transitivity of <. Comparison operations are special because they are used implicitly in other operations. The < operator is used implicitly in bisect. If it does not satisfy the (partial?) order properties, bisect may enter an infinite loop. [1]: http://mathworld.wolfram.com/SetClosure.html