negative numbers and integer division

Matthew Wilson mwilson at sarcastic-horse.com
Fri Oct 3 14:42:48 EDT 2003


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?





More information about the Python-list mailing list