Title: Full yield support, including yield expressions · Issue #498 · python/mypy · GitHub
Open Graph Title: Full yield support, including yield expressions · Issue #498 · python/mypy
X Title: Full yield support, including yield expressions · Issue #498 · python/mypy
Description: In python 3.X yield is a statement (currently supported) but also an expression. You can do something like this: from typing import Iterator def test_yield() -> Iterator[int]: value = 1 try: value = yield value # Here is the yield expres...
Open Graph Description: In python 3.X yield is a statement (currently supported) but also an expression. You can do something like this: from typing import Iterator def test_yield() -> Iterator[int]: value = 1 try: value ...
X Description: In python 3.X yield is a statement (currently supported) but also an expression. You can do something like this: from typing import Iterator def test_yield() -> Iterator[int]: value = 1 try: val...
Opengraph URL: https://github.com/python/mypy/issues/498
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Full yield support, including yield expressions","articleBody":"In python 3.X yield is a statement (currently supported) but also an expression.\nYou can do something like this:\n\n``` python\nfrom typing import Iterator\n\ndef test_yield() -> Iterator[int]:\n value = 1\n try:\n value = yield value # Here is the yield expression\n yield value\n yield value + 1\n except TypeError as e:\n print(e)\n\ngen = test_yield()\nx1 = next(gen)\nx2 = gen.send(2)\nprint(x1) # 1\nprint(x2) # 2\ngen.throw(TypeError, 'ERROR')\ngen.close()\n```\n\nRight now, mypy complains in the expression:\n\n```\n_program.py: In function \"test_yield\":\n_program.py, line 6: Parse error before \"value\"\n```\n\nAnd, also, the Iterator type need the functions send, throw and close, but I think this go in typing project:\n\n```\n_program.py, line 14: Iterator[int] has no attribute \"send\" \n_program.py, line 17: Iterator[int] has no attribute \"throw\" \n_program.py, line 18: Iterator[int] has no attribute \"close\"\n```\n\nThe reference is here: [https://docs.python.org/3.4/reference/expressions.html#yieldexpr](https://docs.python.org/3.4/reference/expressions.html#yieldexpr)\n","author":{"url":"https://github.com/rockneurotiko","@type":"Person","name":"rockneurotiko"},"datePublished":"2014-11-12T11:26:32Z","url":"https://github.com/python/mypy/issues/498"}
| 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:0d56f0b3-10d4-c080-ff60-240378aa896a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2A4:4EE5B:437056:5CB0E2:6B008DF6 |
| html-safe-nonce | 337be2a4d3ab5128d7b0cb8a582c17e55b02b76fa21a3124710865db9ec911c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkE0OjRFRTVCOjQzNzA1Njo1Q0IwRTI6NkIwMDhERjYiLCJ2aXNpdG9yX2lkIjoiMzY1OTc3MjU2Mjc3NjI5Njk1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0bddbb27f9bcdb16731649c66b1d05fc446316b29fe182c01484c596d07ff966 |
| hovercard-subject-tag | issue:48500041 |
| 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/498/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7f13afed860c4ddd39308b55079f09ce69f75e67c7d1d84c3b9f4b60c9537fb9/python/mypy/issues/498 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7f13afed860c4ddd39308b55079f09ce69f75e67c7d1d84c3b9f4b60c9537fb9/python/mypy/issues/498 |
| og:image:alt | In python 3.X yield is a statement (currently supported) but also an expression. You can do something like this: from typing import Iterator def test_yield() -> Iterator[int]: value = 1 try: value ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rockneurotiko |
| hostname | github.com |
| expected-hostname | github.com |
| None | c710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08 |
| 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 | be616a2a6ec1c609d6e002896dff5352d5c5f28b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width