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

Deprecate using math.factorial() with floats #81496

Closed
serhiy-storchaka opened this issue Jun 17, 2019 · 3 comments
Closed

Deprecate using math.factorial() with floats #81496

serhiy-storchaka opened this issue Jun 17, 2019 · 3 comments
Labels
3.9 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 37315
Nosy @rhettinger, @mdickinson, @serhiy-storchaka, @pablogsal
PRs
  • bpo-37315: Deprecate accepting floats in math.factorial(). #14147
  • 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 2019-06-17.14:02:26.198>
    created_at = <Date 2019-06-17.08:49:55.455>
    labels = ['extension-modules', 'type-feature', '3.9']
    title = 'Deprecate using math.factorial() with floats'
    updated_at = <Date 2019-06-17.14:02:26.198>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-06-17.14:02:26.198>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-17.14:02:26.198>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2019-06-17.08:49:55.455>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37315
    keywords = ['patch']
    message_count = 3.0
    messages = ['345828', '345842', '345859']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'mark.dickinson', 'stutzbach', 'serhiy.storchaka', 'pablogsal']
    pr_nums = ['14147']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue37315'
    versions = ['Python 3.9']

    @serhiy-storchaka
    Copy link
    Member Author

    Currently math.factorial() accepts integer-like objects (including objects with defined __index__) as well as float instances with integral value (but not arbitrary float-like objects with defined __float__). I suppose this was happen because factorial() was the first integer functions in the math module, and all other functions accepted floats at that time. See also bpo-7550. But now we have more pure integer functions in the math module: gcd, isqrt, comb, perm. Seems accepting floats in factorial was a mistake. Now we can fix it, and deprecate using factorial() with floats.

    Initial version of factorial() accepted also non-integral numbers (except float) with defined __int__. It was fixed in bpo-33083.

    @serhiy-storchaka serhiy-storchaka added 3.9 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Jun 17, 2019
    @mdickinson
    Copy link
    Member

    +1 from me; let's make factorial consistent with the other integer-based math module functions.

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 231aad3 by Serhiy Storchaka in branch 'master':
    bpo-37315: Deprecate accepting floats in math.factorial(). (GH-14147)
    231aad3

    @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
    3.9 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants