
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-06-06 16:30 byrhettinger, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13905 | merged | rhettinger,2019-06-08 00:20 | |
| PR 13919 | merged | miss-islington,2019-06-08 15:59 | |
| Messages (7) | |||
|---|---|---|---|
| msg344833 -(view) | Author: Raymond Hettinger (rhettinger)*![]() | 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)*![]() | Date: 2019-06-06 16:36 | |
perm(n, n) = factorial(n) | |||
| msg344837 -(view) | Author: Tim Peters (tim.peters)*![]() | Date: 2019-06-06 16:41 | |
I agree: perm(n) should return factorial(n). | |||
| msg344840 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | 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)*![]() | 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)*![]() | 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)*![]() | 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 | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:16 | admin | set | github: 81359 |
| 2019-06-08 23:55:34 | rhettinger | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-06-08 16:17:37 | rhettinger | set | messages: +msg345054 |
| 2019-06-08 15:59:30 | miss-islington | set | pull_requests: +pull_request13792 |
| 2019-06-08 15:58:15 | rhettinger | set | messages: +msg345053 |
| 2019-06-08 03:21:17 | rhettinger | set | messages: +msg345020 |
| 2019-06-08 00:20:08 | rhettinger | set | keywords: +patch stage: patch review pull_requests: +pull_request13778 |
| 2019-06-06 17:02:07 | serhiy.storchaka | set | messages: +msg344840 |
| 2019-06-06 16:41:31 | tim.peters | set | messages: +msg344837 |
| 2019-06-06 16:36:49 | serhiy.storchaka | set | messages: +msg344835 |
| 2019-06-06 16:30:28 | rhettinger | create | |