Title: Classes with __call__ defined should be a subtype of Callable · Issue #797 · python/mypy · GitHub
Open Graph Title: Classes with __call__ defined should be a subtype of Callable · Issue #797 · python/mypy
X Title: Classes with __call__ defined should be a subtype of Callable · Issue #797 · python/mypy
Description: def apply(f: Callable[[int], int], x: int) -> int: return f(x) class Add5(object): def __call__(self, x: int) -> int: return x + 5 apply(Add5(), 5) This code snippet doesn't type check because Mypy doesn't treat Add5() as a Callable[[int...
Open Graph Description: def apply(f: Callable[[int], int], x: int) -> int: return f(x) class Add5(object): def __call__(self, x: int) -> int: return x + 5 apply(Add5(), 5) This code snippet doesn't type check because Mypy...
X Description: def apply(f: Callable[[int], int], x: int) -> int: return f(x) class Add5(object): def __call__(self, x: int) -> int: return x + 5 apply(Add5(), 5) This code snippet doesn't type check be...
Mail addresses
notifications@github.com
Opengraph URL: https://github.com/python/mypy/issues/797
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Classes with __call__ defined should be a subtype of Callable","articleBody":"```\ndef apply(f: Callable[[int], int], x: int) -> int:\n return f(x)\n\nclass Add5(object):\n def __call__(self, x: int) -> int:\n return x + 5\n\napply(Add5(), 5)\n```\n\nThis code snippet doesn't type check because Mypy doesn't treat Add5() as a Callable[[int], int]\n","author":{"url":"https://github.com/zhangwen0411","@type":"Person","name":"zhangwen0411"},"datePublished":"2015-08-18T18:17:51Z","url":"https://github.com/python/mypy/issues/797"}
| 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:c588d6bc-9996-6d73-e454-be4ac6b98c6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5E4:18D1D3:DFE0DF:1243E5E:6AFFFB4A |
| html-safe-nonce | 5f599fa611dee81b27c771a26a73dd9b15afe2888683ce1cee89374c01201de4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUU0OjE4RDFEMzpERkUwREY6MTI0M0U1RTo2QUZGRkI0QSIsInZpc2l0b3JfaWQiOiI4Njc4Mzc0MTYzNzYyNjQxNzM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 31a2d328e5d08bdf660d6a4a3fba77f767e84f2cf8cb6cef2979b247fdb774a6 |
| hovercard-subject-tag | issue:101718228 |
| 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/797/issue_layout |
| twitter:image | https://opengraph.githubassets.com/661ec468d2ea35a8da3b1a4bc90b1bca409fefadc7c0dbe7c25f80e7179b7653/python/mypy/issues/797 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/661ec468d2ea35a8da3b1a4bc90b1bca409fefadc7c0dbe7c25f80e7179b7653/python/mypy/issues/797 |
| og:image:alt | def apply(f: Callable[[int], int], x: int) -> int: return f(x) class Add5(object): def __call__(self, x: int) -> int: return x + 5 apply(Add5(), 5) This code snippet doesn't type check because Mypy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zhangwen0411 |
| 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