Title: Implement generic AST pattern matcher helper · Issue #699 · python/mypy · GitHub
Open Graph Title: Implement generic AST pattern matcher helper · Issue #699 · python/mypy
X Title: Implement generic AST pattern matcher helper · Issue #699 · python/mypy
Description: Currently the mypy implementation has a lot of ad-hoc code that checks whether some part of an AST looks like something specific. For example, we have code that detects various special forms: N = NamedTuple('N', [('x', int), ...]) T = Ty...
Open Graph Description: Currently the mypy implementation has a lot of ad-hoc code that checks whether some part of an AST looks like something specific. For example, we have code that detects various special forms: N = N...
X Description: Currently the mypy implementation has a lot of ad-hoc code that checks whether some part of an AST looks like something specific. For example, we have code that detects various special forms: N = N...
Opengraph URL: https://github.com/python/mypy/issues/699
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Implement generic AST pattern matcher helper","articleBody":"Currently the mypy implementation has a lot of ad-hoc code that checks whether some part of an AST looks like something specific. For example, we have code that detects various special forms:\n\n``` python\nN = NamedTuple('N', [('x', int), ...])\nT = TypeVar('T', int, str)\n```\n\nIt would be better to have a generic utility that makes it easy to write code to detect cases like the above.\n\nA straw man proposal:\n\n``` python\npattern = AstPattern('NameExpr = \"typing.NamedTuple\"(StrExpr, [(StrExpr, Type), ...])')\nresult = pattern.match(ast_node)\nif result:\n name, strlit, tuples = result\n```\n\nThe pattern syntax would be a subset of Python syntax to make the implementation easier (but with different semantics).\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2015-05-31T23:47:53Z","url":"https://github.com/python/mypy/issues/699"}
| 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:55c3f49a-52e2-b16e-40eb-e20b45e86e00 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC96:3EE843:213B614:2D4DC56:6B002929 |
| html-safe-nonce | 7489b5a5cad8ebd1db89b44fd140e365af80acb0272f6807962fd6ebcf7e04bf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzk2OjNFRTg0MzoyMTNCNjE0OjJENERDNTY6NkIwMDI5MjkiLCJ2aXNpdG9yX2lkIjoiMTkyMTA0Nzg5NzI5ODcwODc3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 68f6bd504673ee1d60bbc9c8aac5e9477baf36e7bf9f5bfbebcccfd6b7f6726f |
| hovercard-subject-tag | issue:83226720 |
| 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/699/issue_layout |
| twitter:image | https://opengraph.githubassets.com/242229a78489c4b6566367e699b20085f5d0482605f360de0f448f9b7ce94a46/python/mypy/issues/699 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/242229a78489c4b6566367e699b20085f5d0482605f360de0f448f9b7ce94a46/python/mypy/issues/699 |
| og:image:alt | Currently the mypy implementation has a lot of ad-hoc code that checks whether some part of an AST looks like something specific. For example, we have code that detects various special forms: N = N... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width