negative numbers and integer division

mensanator mensanator at aol.com
Fri Oct 3 17:53:44 EDT 2003


"Matthew Wilson" <mwilson at sarcastic-horse.com> wrote in message news:<mailman.1065206646.19185.python-list at python.org>...
> Hi-
> 
> I just discovered this:
> 
> >>> -1 // 12
>  -1
> >>> 1 // 12
>  0
> >>>
> 
> I thought that -1 // 12 would be 0 also.  I'm writing a simple monthly
> date class and i need (-1,2001) to be translated to (11,2000).  Any ideas?

>>> -1 % 12
11




More information about the Python-list mailing list