Title: iscoroutinefunction should use TypeIs · Issue #15529 · python/typeshed · GitHub
Open Graph Title: iscoroutinefunction should use TypeIs · Issue #15529 · python/typeshed
X Title: iscoroutinefunction should use TypeIs · Issue #15529 · python/typeshed
Description: One of the things I find myself writing a lot is if iscoroutinefunction(myfunction): do_something_with_async(myfunction) else: do_something_with_just_sync(myfunction) however the else block doesn't narrow the type to non-awaitable. Shoul...
Open Graph Description: One of the things I find myself writing a lot is if iscoroutinefunction(myfunction): do_something_with_async(myfunction) else: do_something_with_just_sync(myfunction) however the else block doesn't...
X Description: One of the things I find myself writing a lot is if iscoroutinefunction(myfunction): do_something_with_async(myfunction) else: do_something_with_just_sync(myfunction) however the else block doesn...
Opengraph URL: https://github.com/python/typeshed/issues/15529
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"iscoroutinefunction should use TypeIs","articleBody":"One of the things I find myself writing a lot is\n\n```python\nif iscoroutinefunction(myfunction):\n do_something_with_async(myfunction)\nelse:\n do_something_with_just_sync(myfunction)\n```\n\nhowever the else block doesn't narrow the type to non-awaitable. Shouldn't it? Some of the other `is...` functions in inspect seem to use TypeIs as well.","author":{"url":"https://github.com/Redoubts","@type":"Person","name":"Redoubts"},"datePublished":"2026-03-20T00:56:49Z","url":"https://github.com/python/typeshed/issues/15529"}
| 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:4b495ae4-6fcb-9cd8-b974-7d6c487df8d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE66:14B08B:13722B7:1983443:6B0007BF |
| html-safe-nonce | 8c40b9185b2601129f117b4a88b44427157a20758aced7160ac4676ed0e04cb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTY2OjE0QjA4QjoxMzcyMkI3OjE5ODM0NDM6NkIwMDA3QkYiLCJ2aXNpdG9yX2lkIjoiNTIwMjkyNzExNjQ5NjE0NDMxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e89628279ce914c5d59e318546d4b82e06f73fad620d9f0b12432fd3dd42c9f1 |
| hovercard-subject-tag | issue:4105043750 |
| 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/15529/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5f836b14ae9f48aceea6d9c036857aa280dbb04d1279789fed753fa5e7c03f75/python/typeshed/issues/15529 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5f836b14ae9f48aceea6d9c036857aa280dbb04d1279789fed753fa5e7c03f75/python/typeshed/issues/15529 |
| og:image:alt | One of the things I find myself writing a lot is if iscoroutinefunction(myfunction): do_something_with_async(myfunction) else: do_something_with_just_sync(myfunction) however the else block doesn't... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Redoubts |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width