This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Retro
Recipients Retro, belopolsky, eric.araujo, georg.brandl, pjenvey, r.david.murray, shadikka, terry.reedy
Date 2010-10-17.19:54:21
SpamBayes Score 1.2233571e-05
Marked as misclassified No
Message-id <1287345265.27.0.958642819907.issue10073@psf.upfronthosting.co.za>
In-reply-to
Content
Let me fix this function a little bit...

def isleap(year):
    """Return True for leap years, False for non-leap years."""
    if year == 0:
        raise ValueError('year 0 does not exist')
    return (year % 4 == 0) and (year % 100 != 0) or (year % 400 == 0)

This function, however, does not mind if you give it a negative number. But I think we can leave this option to mean B.C. (Before Christ), so calendar.isleap(-240) would mean 240 B.C., which was a leap year.

About the  if year == 0  check... Well, read Wikipedia's article  http://en.wikipedia.org/wiki/0_(year)  which clearly states that "Year zero does not exist in the widely used Gregorian calendar or in its predecessor, the Julian calendar."  So we raise a ValueError if this value is used in the calendar.isleap() function.

I have uploaded a patch that fixes this function. Please apply it to the trunk and also to the maintenance brances.
History
Date User Action Args
2010-10-17 19:54:25Retrosetrecipients: + Retro, georg.brandl, terry.reedy, belopolsky, pjenvey, eric.araujo, r.david.murray, shadikka
2010-10-17 19:54:25Retrosetmessageid: <1287345265.27.0.958642819907.issue10073@psf.upfronthosting.co.za>
2010-10-17 19:54:23Retrolinkissue10073 messages
2010-10-17 19:54:23Retrocreate