Title: More flexible type support for `math.prod` and `math.sumprod` · Issue #13501 · python/typeshed · GitHub
Open Graph Title: More flexible type support for `math.prod` and `math.sumprod` · Issue #13501 · python/typeshed
X Title: More flexible type support for `math.prod` and `math.sumprod` · Issue #13501 · python/typeshed
Description: Also related to #11913 Currently, math.prod and math.sumprod do not properly support Decimal, Fraction, complex, or possibly other numeric types. This makes it inconvenient to replace builtins.sum with math.prod in a straightforward mann...
Open Graph Description: Also related to #11913 Currently, math.prod and math.sumprod do not properly support Decimal, Fraction, complex, or possibly other numeric types. This makes it inconvenient to replace builtins.sum ...
X Description: Also related to #11913 Currently, math.prod and math.sumprod do not properly support Decimal, Fraction, complex, or possibly other numeric types. This makes it inconvenient to replace builtins.sum ...
Opengraph URL: https://github.com/python/typeshed/issues/13501
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"More flexible type support for `math.prod` and `math.sumprod`","articleBody":"Also related to https://github.com/python/typeshed/issues/11913\n\nCurrently, `math.prod` and `math.sumprod` do not properly support `Decimal`, `Fraction`, `complex`, or possibly other numeric types. This makes it inconvenient to replace `builtins.sum` with `math.prod` in a straightforward manner.\n\n```py\nfrom typing import reveal_type\nfrom fractions import Fraction\nfrom math import prod\n\na = prod([Fraction(1), Fraction(2)])\nreveal_type(a) # it should be Fraction | Literal[1], but float for now\n\nprod([complex(1, 0), complex(1, 2)])\n```\n\n[Mypy Playground Link](https://mypy-play.net/?mypy=latest&python=3.12&gist=a33e631aa919ed1879e1b7dd9ac5d8b1)\n\n\nI believe it should be followed the type stub of `builtins.sum`, but I’m not sure what breaking changes this might cause.","author":{"url":"https://github.com/cake-monotone","@type":"Person","name":"cake-monotone"},"datePublished":"2025-02-14T16:53:02Z","url":"https://github.com/python/typeshed/issues/13501"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a0393da8-b58b-5788-966e-495b0d61ae28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD50:3E7030:920552:C3B376:6B004427 |
| html-safe-nonce | 77675da74ce7368c1f32c1b0b3327ad39aa7594846b54011ead5b95c78a11c3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDUwOjNFNzAzMDo5MjA1NTI6QzNCMzc2OjZCMDA0NDI3IiwidmlzaXRvcl9pZCI6IjMwMjgxODI2NDk2NDM0ODQxOTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 219a2d40f08ff7f612071af0fe0cf8caae649008aaeec65053f7b10c0c3af29a |
| hovercard-subject-tag | issue:2854265857 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/13501/issue_layout |
| twitter:image | https://opengraph.githubassets.com/014e8ee2a379db60ea62ed4ac64e00b405a0228d455d78e9f7fb01eeb20f531a/python/typeshed/issues/13501 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/014e8ee2a379db60ea62ed4ac64e00b405a0228d455d78e9f7fb01eeb20f531a/python/typeshed/issues/13501 |
| og:image:alt | Also related to #11913 Currently, math.prod and math.sumprod do not properly support Decimal, Fraction, complex, or possibly other numeric types. This makes it inconvenient to replace builtins.sum ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cake-monotone |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width