Title: Doubt in `spinner_async.py` example · Issue #37 · fluentpython/example-code-2e · GitHub
Open Graph Title: Doubt in `spinner_async.py` example · Issue #37 · fluentpython/example-code-2e
X Title: Doubt in `spinner_async.py` example · Issue #37 · fluentpython/example-code-2e
Description: Hi Luciano, I am playing a bit with the spinner_async.py example, and I am wondering why the execution finishes normally when I comment the spinner.cancel() line in the supervisor function. I think the execution should stay in an infinit...
Open Graph Description: Hi Luciano, I am playing a bit with the spinner_async.py example, and I am wondering why the execution finishes normally when I comment the spinner.cancel() line in the supervisor function. I think...
X Description: Hi Luciano, I am playing a bit with the spinner_async.py example, and I am wondering why the execution finishes normally when I comment the spinner.cancel() line in the supervisor function. I think...
Opengraph URL: https://github.com/fluentpython/example-code-2e/issues/37
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Doubt in `spinner_async.py` example","articleBody":"Hi Luciano,\r\n\r\nI am playing a bit with the [`spinner_async.py`](https://github.com/fluentpython/example-code-2e/blob/master/19-concurrency/spinner_async.py) example, and I am wondering why the execution finishes normally when I comment the `spinner.cancel()` line in the `supervisor` function. I think the execution should stay in an infinite loop because I am not cancelling the coroutine and, therefore the `asyncio.CancelledError` exception is never raised.\r\n\r\n```python3\r\nasync def supervisor() -\u003e int: # \u003c3\u003e\r\n spinner = asyncio.create_task(spin('thinking!')) # \u003c4\u003e\r\n print(f'spinner object: {spinner}') # \u003c5\u003e\r\n result = await slow() # \u003c6\u003e\r\n #spinner.cancel() # \u003c------This is the only change \u003c7\u003e\r\n return result\r\n```\r\n\r\nI am forgetting something?, any comments to help me to understand this scenario are welcome.","author":{"url":"https://github.com/CarMoreno","@type":"Person","name":"CarMoreno"},"datePublished":"2023-08-07T08:14:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/37/example-code-2e/issues/37"}
| 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:d97899a8-8433-929e-b3fc-971bcbbcc4fb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1DA:158E36:37D9FBC:4B1EE1F:697077B9 |
| html-safe-nonce | 1d7e9c20cbb243c2360a3eac1e5c7b41ee42bc0065be98288752978a6c8b71f7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMURBOjE1OEUzNjozN0Q5RkJDOjRCMUVFMUY6Njk3MDc3QjkiLCJ2aXNpdG9yX2lkIjoiMTg5MDg0NDA3OTY3MDIwOTg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 762d2313f72634e213239b9f88bd31d472c2e01ae75f823bd5c1d209f8cf5979 |
| hovercard-subject-tag | issue:1838929090 |
| 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/fluentpython/example-code-2e/37/issue_layout |
| twitter:image | https://opengraph.githubassets.com/97c9e7ec333b0fc4f063df81e8fcac39f6477e931a23e31a921f0a24170140bb/fluentpython/example-code-2e/issues/37 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/97c9e7ec333b0fc4f063df81e8fcac39f6477e931a23e31a921f0a24170140bb/fluentpython/example-code-2e/issues/37 |
| og:image:alt | Hi Luciano, I am playing a bit with the spinner_async.py example, and I am wondering why the execution finishes normally when I comment the spinner.cancel() line in the supervisor function. I think... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CarMoreno |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/fluentpython/example-code-2e git https://github.com/fluentpython/example-code-2e.git |
| octolytics-dimension-user_id | 9216311 |
| octolytics-dimension-user_login | fluentpython |
| octolytics-dimension-repository_id | 176997413 |
| octolytics-dimension-repository_nwo | fluentpython/example-code-2e |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 176997413 |
| octolytics-dimension-repository_network_root_nwo | fluentpython/example-code-2e |
| 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 | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width