[Patches] [ python-Patches-483864 ] Pure python version of calendar.weekday
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 18 Jun 2002 12:06:34 -0700
Patches item #483864, was opened at 2001-11-20 12:42
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=483864&group_id=5470
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
Resolution: Rejected
Priority: 5
Submitted By: Hye-Shik Chang (perky)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Pure python version of calendar.weekday
Initial Comment:
this version can handle past of 1970, and PURE.
but this is not too slower than old one.
NetBSD machine on Pentium 90MHz:
$ python wday.py 1000
Time Module: 0.641623973846
Pure Python: 0.724056005478
$ python wday.py 10000
Time Module: 6.77021896839
Pure Python: 7.34891104698
Linux machine on Pentium III 800MHz:
$ python wday.py 10000
Time Module: 0.611389994621
Pure Python: 0.833150982857
$ python wday.py 100000
Time Module: 6.12289500237
Pure Python: 8.36460494995
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-18 13:18
Message:
Logged In: YES
user_id=6380
I'm against all maintenance on the calendar module.
Fred Drake & I are (slowly) working on a new datetime
module, in the nondist/sandbox/datetime/ part of the
Python CVS tree. This will support a much larger
range of dates. It will be in Python 2.3.
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2002-06-17 21:25
Message:
Logged In: YES
user_id=55188
Thanks, all!
How do you feel with revised patches and verifyier?
I can get Okay from FreeBSD ncal(1).
home(perky):~/cvs/python/Lib% python verify_calendar.py
test_daygap (__main__.CalendarUnixVerifyCase) ... ok
test_weekday (__main__.CalendarUnixVerifyCase) ... ok
----------------------------------------------------------------------
Ran 2 tests in 5.027s
OK
----------------------------------------------------------------------
Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-06-17 16:24
Message:
Logged In: YES
user_id=3066
As Raymond noted, this patch is out of date. Please provide
an updated patch, addressing the concerns already noted.
Assigned to Raymond since he's demonstrated an interest, and
marked pending so it doesn't annoy him until there's a new
patch.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-05-08 01:14
Message:
Logged In: YES
user_id=80475
Thanks for the patch. Here are a few suggestions:
- Use diff -c for your patch
- Update the patch to diff from the current version, 1.27.
- Also change the library reference which specifies 1970.
- Expand test_calendar.py to include your expanded range.
- Add a range check to weekday() to raise an Error if date
is before 1752 (this will be a common error if the century
is omitted in a call). The current treat is to raise
ValueError: year out of range.
- Eliminate the comment # Importing add from operator
- Change the multi-line style away from using \ which
relies on there being no extra spaces at the end of a
line. Instead write:
sum = a +
b -
c
- Revise the doc string to specify "Accurate for date from
September 14, 1752". As specified now, it implies accuracy
to the beginning of that year.
- Create a special case for monthcalendar() to handle
September 1752
- Submit a separate Python program that runs every possible
monthcalendar from 1752 and compares the result to the Unix
cal program. I checked your logic and it looks fine, but a
comprehensive compare will be doubly persuasive. Some
similar proof of daygap() would be helpful.
- Either add daygap() to the docs or incorporate it
directly inside weekday().
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2001-11-20 12:51
Message:
Logged In: YES
user_id=55188
upper one of two patches is using if - if.
another is using and - or.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=483864&group_id=5470