[issue16078] Calendar.leapdays(y1,y2) bug

2012-09-28 Thread Sasa Banjac

New submission from Sasa Banjac:

Hello!
I am using the calendar.leapdays(y1,y2) function. It should return the number 
of leap years betwwen y1 and y2 (exclusive). However the function still cant 
process mutliple centuries.
Example: between 1900 and 2000 we have 24 leap years:
1904,08,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96
leapdays(1900,2000) returns 24 - OK
however
leapdays(1899,2000) returns also 24 NOT OK
leapdays(1899,2001) returns 25 NOT OK
leapdays(1900,2001) returns 25 OK

This means that the function has a problem with the lower boundary
If I try to calculate the number of leap days in a larger interval of years, 
the error is considerable:
leapdays(1,2001) returns 485
But 485 * 4 = 1940

--
components: Library (Lib)
messages: 171427
nosy: sbanjac
priority: normal
severity: normal
status: open
title: Calendar.leapdays(y1,y2) bug
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16078
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16078] Calendar.leapdays(y1,y2) bug

2012-09-28 Thread Peter Inglesby

Peter Inglesby added the comment:

This behaviour is correct.  Years divisible by 4 are leap years, except years 
divisible by 100, except years divisible 400.

Source http://en.wikipedia.org/wiki/Leap_year.

--
nosy: +inglesp

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16078
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16078] Calendar.leapdays(y1,y2) bug

2012-09-28 Thread Peter Inglesby

Changes by Peter Inglesby peter.ingle...@gmail.com:


--
nosy: +larry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16078
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16078] Calendar.leapdays(y1,y2) bug

2012-09-28 Thread Larry Hastings

Larry Hastings added the comment:

Agreed.  Not a bug.  Closing the issue.

--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16078
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com