Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use datetime in _strptime #38035

Closed
brettcannon opened this issue Feb 24, 2003 · 6 comments
Closed

Use datetime in _strptime #38035

brettcannon opened this issue Feb 24, 2003 · 6 comments
Labels
stdlib Python modules in the Lib dir

Comments

@brettcannon
Copy link
Member

BPO 691928
Nosy @smontanaro, @brettcannon, @rhettinger
Files
  • use_datetime.diff: 2003-02-23: diff -u
  • use_datetime.diff: 2003-02-25: diff -u
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2003-03-09.07:56:49.000>
    created_at = <Date 2003-02-24.00:07:59.000>
    labels = ['library']
    title = 'Use datetime in _strptime'
    updated_at = <Date 2003-03-09.07:56:49.000>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2003-03-09.07:56:49.000>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-02-24.00:07:59.000>
    creator = 'brett.cannon'
    dependencies = []
    files = ['5039', '5040']
    hgrepos = []
    issue_num = 691928
    keywords = ['patch']
    message_count = 6.0
    messages = ['42878', '42879', '42880', '42881', '42882', '42883']
    nosy_count = 4.0
    nosy_names = ['skip.montanaro', 'nnorwitz', 'brett.cannon', 'rhettinger']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue691928'
    versions = ['Python 2.3']

    @brettcannon
    Copy link
    Member Author

    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.

    @brettcannon brettcannon added the stdlib Python modules in the Lib dir label Feb 24, 2003
    @brettcannon brettcannon added the stdlib Python modules in the Lib dir label Feb 24, 2003
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Feb 24, 2003

    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).

    @brettcannon
    Copy link
    Member Author

    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.

    @smontanaro
    Copy link
    Contributor

    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.

    @brettcannon
    Copy link
    Member Author

    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.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    Applied patch as:

    Lib/_strptime.py 1.13
    Lib/test/test_strptime.py 1.10

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants