Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-17 Thread Mark Dickinson
On Fri, Apr 17, 2009 at 3:58 PM, Scott David Daniels wrote: > Non-associativity is what makes for floating point headaches. > To my knowledge, floating point is at least commutative. Well, mostly. :-) >>> from decimal import Decimal >>> x, y = Decimal('NaN123'), Decimal('-NaN456') >>> x + y Deci

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-17 Thread Scott David Daniels
Greg Ewing wrote: Steven D'Aprano wrote: it should be obvious in the same way that string concatenation is different from numerical addition: 1 + 2 = 2 + 1 '1' + '2' != '2' + '1' However, the proposed arithmetic isn't just non- commutative, it's non-associative, which is a much rarer and mor

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Greg Ewing
Steven D'Aprano wrote: it should be obvious in the same way that string concatenation is different from numerical addition: 1 + 2 = 2 + 1 '1' + '2' != '2' + '1' However, the proposed arithmetic isn't just non- commutative, it's non-associative, which is a much rarer and more surprising thing

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Steven D'Aprano
On Fri, 17 Apr 2009 12:10:59 pm Tennessee Leeuwenburg wrote: > Actually, that's a point. > > If its' the 31st of Jan, then +1 monthdelta will be 28 Feb and > another +1 will be 28 March whereas 31st Jan +2 monthdeltas will be > 31 March. > > That's the kind of thing which really needs to be documen

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread skip
Tennessee> If its' the 31st of Jan, then +1 monthdelta will be 28 Feb Tennessee> and another +1 will be 28 March whereas 31st Jan +2 Tennessee> monthdeltas will be 31 March. Other possible arithmetics: * 31 Jan 2008 + monthdelta(2) might be 31 Jan 2008 + 31 days (# days i

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Tennessee Leeuwenburg
Actually, that's a point. If its' the 31st of Jan, then +1 monthdelta will be 28 Feb and another +1 will be 28 March whereas 31st Jan +2 monthdeltas will be 31 March. That's the kind of thing which really needs to be documented, or I think people really will make mistakes. For example, should a

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Greg Ewing
Jess Austin wrote: This is a perceptive observation: in the absence of parentheses to dictate a different order of operations, the third quantity will differ from the second. Another aspect of this is the use case mentioned right at the beginning of this discussion concerning a recurring event

Re: [Python-Dev] Python-Dev Digest, Vol 69, Issue 143

2009-04-16 Thread Jess Austin
Jared Grubb wrote: > On 16 Apr 2009, at 11:42, Paul Moore wrote: >> The key thing missing (I believe) from dateutil is any equivalent of >> monthmod. > > > I agree with that. It's well-defined and it makes a lot of sense. +1 > > But, I dont think monthdelta can be made to work... what should the >