Skip to content

Add math.perm() #81309

Closed
Closed

Description

@serhiy-storchaka
BPO 37128
Nosy @malemburg, @rhettinger, @mdickinson, @serhiy-storchaka
PRs
  • bpo-37128: Add math.perm(). #13731
  • 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-02.08:53:34.710>
    created_at = <Date 2019-06-01.20:47:29.810>
    labels = ['3.8', 'type-feature', 'library']
    title = 'Add math.perm()'
    updated_at = <Date 2019-06-02.08:53:41.312>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-06-02.08:53:41.312>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-02.08:53:34.710>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2019-06-01.20:47:29.810>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37128
    keywords = ['patch']
    message_count = 4.0
    messages = ['344226', '344227', '344228', '344259']
    nosy_count = 5.0
    nosy_names = ['lemburg', 'rhettinger', 'mark.dickinson', 'stutzbach', 'serhiy.storchaka']
    pr_nums = ['13731']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue37128'
    versions = ['Python 3.8']

    Activity

    1. serhiy-storchaka commented on Jun 1, 2019

      @serhiy-storchaka
      MemberAuthor

      The function which returns the number of ways to choose k items from n items without repetition and without order was added in bpo-35431. This functions is always goes in pair with other function, which returns the number of ways to choose k items from n items without repetition and with order. These functions are always learned together in curses of combinatorics. Often C(n,k) is determined via P(n,k) (and both are determined via factorial).

      P(n, k) = n! / (n-k)!
      C(n, k) = P(n, k) / k!
      

      The proposed PR adds meth.perm(). It shares most of the code with math.comb().

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jun 1, 2019
    3. rhettinger commented on Jun 1, 2019

      @rhettinger
      Contributor

      +0 from me. It is inevitable that this will be requested now that we have comb(). The need for this is much less though.

    4. mdickinson commented on Jun 1, 2019

      @mdickinson
      Member

      +0 from me. It is inevitable that this will be requested now that we have comb().

      Exactly my thoughts, too. I don't think I'll have any use for math.perm; the main reason to add it will be to satisfy all those who got taught combinations and permutations at the same time, see them as a unit, and then get surprised when they find math.comb without math.perm.

      The good part is that now that we have math.comb, I think everything about the API of math.perm is already clear (including what to call it).

    5. serhiy-storchaka commented on Jun 2, 2019

      @serhiy-storchaka
      MemberAuthor

      New changeset 5ae299a by Serhiy Storchaka in branch 'master':
      bpo-37128: Add math.perm(). (GH-13731)
      5ae299a

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions