Title: Add full support for functools.lru_cache · Issue #19291 · python/mypy · GitHub
Open Graph Title: Add full support for functools.lru_cache · Issue #19291 · python/mypy
X Title: Add full support for functools.lru_cache · Issue #19291 · python/mypy
Description: I don't think there's anything actionable for mypy here in any case. functools.partial was recently special-cased, is there any appetite to do the same for lru_cache, given it's comparably widespread usage? Originally posted by @gandhis1...
Open Graph Description: I don't think there's anything actionable for mypy here in any case. functools.partial was recently special-cased, is there any appetite to do the same for lru_cache, given it's comparably widespre...
X Description: I don't think there's anything actionable for mypy here in any case. functools.partial was recently special-cased, is there any appetite to do the same for lru_cache, given it's compara...
Opengraph URL: https://github.com/python/mypy/issues/19291
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add full support for functools.lru_cache","articleBody":"> I don't think there's anything actionable for mypy here in any case.\n> \n> \n> \n> `functools.partial` was recently special-cased, is there any appetite to do the same for `lru_cache`, given it's comparably widespread usage? \n\n _Originally posted by @gandhis1 in [#5107](https://github.com/python/mypy/issues/5107#issuecomment-2264236790)_\n\nIn the above issue it was described how Mypy's support for lru_cache, which depends on typeshed, can only support enforcement of parameter hashability and the available methods on the LRU cache wrapper like `cache_clear`.\n\nIt can verify positional argument types, but it does not support verifying the number of arguments, or keyword arguments. Here is an example:\n\nhttps://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=5a93906d553a71d7920aafb250f2773f\n\nThis is a significant limitation, for what I would say is a very commonly-used standard library function.\n\nIn https://github.com/python/mypy/pull/16939 special support was added for `functools.partial` for comparable limitations in the typeshed definition. Can the same be done for `functools.lru_cache`?","author":{"url":"https://github.com/gandhis1","@type":"Person","name":"gandhis1"},"datePublished":"2025-06-13T14:57:35Z","url":"https://github.com/python/mypy/issues/19291"}
| 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:4108e6e3-f03d-320c-9d5a-e6a61d742c25 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C848:73851:226158:2F89B6:6B000ACD |
| html-safe-nonce | 23dfa6929d906ae441c39e830708bd877b36958b38a6fb6945634d029f8500e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODQ4OjczODUxOjIyNjE1ODoyRjg5QjY6NkIwMDBBQ0QiLCJ2aXNpdG9yX2lkIjoiNjA3MTQ0NDUxNTM1MTE2OTc0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11822d576582cd32cd30f2d2911fa6be9395871a827837879c85352cc15dd8ef |
| hovercard-subject-tag | issue:3143852846 |
| 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/mypy/19291/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3bfe2367a2b1cc2bd7af8a3402f16c39c770e96e0bd200b82bf4fef6424440b4/python/mypy/issues/19291 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3bfe2367a2b1cc2bd7af8a3402f16c39c770e96e0bd200b82bf4fef6424440b4/python/mypy/issues/19291 |
| og:image:alt | I don't think there's anything actionable for mypy here in any case. functools.partial was recently special-cased, is there any appetite to do the same for lru_cache, given it's comparably widespre... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gandhis1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width