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

datetime.monthdelta #49684

Closed
jessaustin mannequin opened this issue Mar 7, 2009 · 10 comments
Closed

datetime.monthdelta #49684

jessaustin mannequin opened this issue Mar 7, 2009 · 10 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jessaustin
Copy link
Mannequin

jessaustin mannequin commented Mar 7, 2009

BPO 5434
Nosy @malemburg, @tim-one, @abalkin
Files
  • monthdelta.py: prototype implementation in python
  • monthdelta3.diff: unified patch on py3k
  • 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 = 'https://github.com/abalkin'
    closed_at = <Date 2010-06-02.18:14:41.637>
    created_at = <Date 2009-03-07.05:04:48.597>
    labels = ['type-feature', 'library']
    title = 'datetime.monthdelta'
    updated_at = <Date 2011-01-10.23:35:14.184>
    user = 'https://bugs.python.org/jessaustin'

    bugs.python.org fields:

    activity = <Date 2011-01-10.23:35:14.184>
    actor = 'adamnelson'
    assignee = 'belopolsky'
    closed = True
    closed_date = <Date 2010-06-02.18:14:41.637>
    closer = 'belopolsky'
    components = ['Library (Lib)']
    creation = <Date 2009-03-07.05:04:48.597>
    creator = 'jess.austin'
    dependencies = []
    files = ['13307', '13743']
    hgrepos = []
    issue_num = 5434
    keywords = ['patch']
    message_count = 10.0
    messages = ['83272', '83273', '83275', '83480', '84114', '86323', '106495', '106846', '106906', '125955']
    nosy_count = 6.0
    nosy_names = ['lemburg', 'tim.peters', 'belopolsky', 'jess.austin', 'cvrebert', 'adamnelson']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue5434'
    versions = ['Python 3.1']

    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Mar 7, 2009

    datetime is a wonderful module. Perhaps the only inconvenient aspect of
    using it is dealing with month calculations and comparisons. This patch
    adds a simple class, monthdelta, which represents date offsets in terms
    of months. It supports basic integer-like arithmetic, and also it may
    be added to dates and datetimes. It deals sensibly with leap-year and
    month-length issues. Also provided is a function, monthmod (named by
    imperfect analogy to divmod), which allows round-tripping: that is,
    taking 2 dates and returning a (monthdelta, timedelta) tuple that
    represents the interim between the dates.

    Note: I have named the class "monthdelta", but in light of recent
    python-dev discussions I should probably rename this to "MonthDelta".

    @jessaustin jessaustin mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Mar 7, 2009
    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Mar 7, 2009

    This is my first try at a patch. All functionality, tests, and
    documentation are included, but I won't be surprised if I need to make
    some changes! Please let me know.

    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Mar 7, 2009

    Rietveld link: http://codereview.appspot.com/25079

    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Mar 11, 2009

    This prototype python implementation passes the same tests that the C
    implementation in the patch does (modulo import differences). I'll
    probably backport this for 2.x versions.

    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Mar 24, 2009

    With the rejection of bpo-5530, it seems best for the name of this
    class to remain lowercase. Mixing casing schemes within the same module
    would be perverse.

    @jessaustin jessaustin mannequin changed the title datetime.MonthDelta datetime.monthdelta Mar 24, 2009
    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Apr 22, 2009

    The backport through python 2.3 is up at PyPI:
    http://pypi.python.org/pypi?name=MonthDelta&:action=display

    Download source and install, or just easy_install. Documentation is
    also linked at PyPI.

    @abalkin
    Copy link
    Member

    abalkin commented May 26, 2010

    MonthDelta has been published on PyPI and there was no activity on this issue since then. I conclude that there is little support for including this in stdlib. I am marking this as "rejected" and setting the status to pending. I will close this issue in a few weeks unless I hear objections.

    Jess,

    I see that your package is healthy on PyPI with over 700 downloads for the latest version. Note that some additional operations have been added recently to timedelta object and more are in the works. You may want to consider adding them to the next version of your package. (See bpo-1289118 and bpo-2706.)

    @abalkin abalkin self-assigned this May 26, 2010
    @jessaustin
    Copy link
    Mannequin Author

    jessaustin mannequin commented Jun 1, 2010

    Yeah, the masses have spoken, and their silence is deafening. I was going to downplay the "health" of the package based on the number of downloads, but then I looked at the "futures" page. b^) Seriously, getting this in would require a core developer wanting it in, and at this point it seems none do.

    On the subject of float operations, while there may be some question about the integerness or floatness of timedelta, monthdelta is definitely an integer. As monthdelta already supports multiplication by integers and floor division by integers or monthdeltas, I don't see anything missing. To use monthdeltas with floats is to miss the point entirely.

    @abalkin
    Copy link
    Member

    abalkin commented Jun 2, 2010

    Rejecting this for stdlib. A 3rd party package is available at http://pypi.python.org/pypi?name=MonthDelta&:action=display .

    @abalkin abalkin closed this as completed Jun 2, 2010
    @adamnelson
    Copy link
    Mannequin

    adamnelson mannequin commented Jan 10, 2011

    For future reference, python-dateutil seems like the maintained way to deal with "human" dates outside of the stdlib.

    http://pypi.python.org/pypi/python-dateutil

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 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 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant