Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue37178

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:One argument form of math.perm()
Type:Stage:resolved
Components:Library (Lib)Versions:Python 3.9, Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: mark.dickinson, rhettinger, serhiy.storchaka, tim.peters
Priority:normalKeywords:patch

Created on2019-06-06 16:30 byrhettinger, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 13905mergedrhettinger,2019-06-08 00:20
PR 13919mergedmiss-islington,2019-06-08 15:59
Messages (7)
msg344833 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2019-06-06 16:30
The perm() function should have a one argument form and change its signature to ``perm(n, k=None)``.  This matches what itertools:itertools.permutations(iterable, r=None)   Return successive r length permutations of elements   in the iterable.   If r is not specified or is None, then r defaults to   the length of the iterable and all possible full-length   permutations are generated.
msg344835 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2019-06-06 16:36
perm(n, n) = factorial(n)
msg344837 -(view)Author: Tim Peters (tim.peters)*(Python committer)Date: 2019-06-06 16:41
I agree: perm(n) should return factorial(n).
msg344840 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2019-06-06 17:02
I never seen a one argument form of P(n, k) in mathematics. itertools.permutations() corresponds two functions: math.perm() and math .factorial(). Unless you a going to add a new function in the itertools module equal to a one argument form of itertools.permutations() there will be no full symmetry.
msg345020 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2019-06-08 03:21
It's possible the word permutations means something different to you than it does to me.  The itertools.permutations() function is only one function, one that includes the default option to generate all permutations.  It does the same as permute(n, r) and permute(n) in Maple; and the same as Permutations[list, n] and Permutations[list] in Mathematica.  For the math module, perm(n) is just a common special case that means all possible arrangements.
msg345053 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2019-06-08 15:58
New changesete119b3d136bd94d880bce4b382096f6de3f38062 by Raymond Hettinger in branch 'master':bpo-37178: Allow a one argument form of math.perm() (GH-13905)https://github.com/python/cpython/commit/e119b3d136bd94d880bce4b382096f6de3f38062
msg345054 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2019-06-08 16:17
New changesetfeaceaafe816e95c4aff15eab0bea6dc2bbfe4fd by Raymond Hettinger (Miss Islington (bot)) in branch '3.8':bpo-37178: Allow a one argument form of math.perm() (GH-13905) (GH-13919)https://github.com/python/cpython/commit/feaceaafe816e95c4aff15eab0bea6dc2bbfe4fd
History
DateUserActionArgs
2022-04-11 14:59:16adminsetgithub: 81359
2019-06-08 23:55:34rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-06-08 16:17:37rhettingersetmessages: +msg345054
2019-06-08 15:59:30miss-islingtonsetpull_requests: +pull_request13792
2019-06-08 15:58:15rhettingersetmessages: +msg345053
2019-06-08 03:21:17rhettingersetmessages: +msg345020
2019-06-08 00:20:08rhettingersetkeywords: +patch
stage: patch review
pull_requests: +pull_request13778
2019-06-06 17:02:07serhiy.storchakasetmessages: +msg344840
2019-06-06 16:41:31tim.peterssetmessages: +msg344837
2019-06-06 16:36:49serhiy.storchakasetmessages: +msg344835
2019-06-06 16:30:28rhettingercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp