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.

classification
Title: Use datetime in _strptime
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, nnorwitz, rhettinger, skip.montanaro
Priority: normal Keywords: patch

Created on 2003-02-24 00:07 by brett.cannon, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
use_datetime.diff brett.cannon, 2003-02-24 00:09 2003-02-23: diff -u
use_datetime.diff brett.cannon, 2003-02-25 21:52 2003-02-25: diff -u
Messages (6)
msg42878 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-02-24 00:07
To prevent code duplication, I patched _strptime to use datetime's date object to do Julian day, Gregorian, and day of the week calculations (Tim's code has to be more reliable than mine  =).  Patch also includes new regression tests to test results and calculation gets triggered.

Very minor comment changes and my contact email are also changed.
msg42879 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2003-02-24 00:56
Logged In: YES 
user_id=33168

Brett, is there any doc for the functions that were removed?
   firstjulian, gregorian, julianday, dayofweek

Otherwise, the patch seemed fine (but I didn't look that
closely).
msg42880 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-02-25 21:51
Logged In: YES 
user_id=357491

Only in the module (which was removed).  None of the helper functions have ever been publicly advertised (although I think the locale date info might be helpful in locale; MvL wasn't interested, though).

I uploaded a new diff that removes one more line that I forgot to remove when I eliminated the ability to pass in a regex object.
msg42881 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2003-03-03 15:03
Logged In: YES 
user_id=44345

Meta comment - I think that when uploading successive patches it's useful
to either name them differently or delete the prior one to avoid confusion.
In this case it's not a big deal, especially since the submission dates are
different, but after a few revisions it can sometimes be a challenge to
figure out which patch should be downloaded.
 
Comment comment - Unless there's some evidence the elided functions
have been used, I suspect it best to just let people use the relevant
datetime functions.
msg42882 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-03-03 21:14
Logged In: YES 
user_id=357491

Response to meta comment - I would normally delete it, Skip, but last time I tried I was told I didn't have the proper rights to do it.  Unless SF has changed their setup to allow patch creators to manage the files regardless of whether they have CVS access I can't.

Response to comment comment - The reason I am doing this is that I want to make sure that the returned time tuple is a valid date.  If strptime is going to have default values I want those values to lead to a valid time that does not require someone to have to do more processing or wonder whether it is valid.

Now currently the docs say you can't expect anything back in the time tuple but what was in the data string, so doing this does not go against the docs.  But if strptime becomes the only strptime implementation, then I will write a doc patch to make the docs say that all returned time tuples will be valid dates.
msg42883 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-03-09 07:56
Logged In: YES 
user_id=80475

Applied patch as:

Lib/_strptime.py 1.13
Lib/test/test_strptime.py 1.10
History
Date User Action Args
2022-04-10 16:07:03adminsetgithub: 38035
2003-02-24 00:07:59brett.cannoncreate