On 9/12/2015 1:04 PM, Alexander Belopolsky wrote: > > > On Sat, Sep 12, 2015 at 1:20 AM, Terry Reedy <tjreedy at udel.edu > <mailto:tjreedy at 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). I am aware of the single-operation group theory convention, but the context was sequence concatenation and scalar multiplication, where '*' is repeated '+'. But these details are not directly relevant to DateTimes. > After closure, I perhaps should have said 'completeness'. In any case, I was referring to 'a op b' existing for all a and b in the set. > 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), Your correction, summarized, is that there are no gaps, so the set is simpler than I thought. Skipping on to the heart of the matter. > I am not concerned about '-'. My main concern is about order > operations. Is not '<' defined, in the obvious way, in terms of '-' and the sign of the resul? > I am happy with the solution I have for ==, but I am still > struggling with the non-transitivity of <. I am guessing that the 'struggle' is at least partly this: "Is non-transitivity of < necessary given other constraints, including back-compatibility, or is there another solution possible that would also be <-transitive?" > 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. and, if we are stuck with <-intransitivity, what do we do? If back-compatibility allowed, I might suggest defining 'lt' or 'less' rather than '__lt__' so that sort and bisect don't work with DateTimes. Then document that the function is not transitive. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4