Hacker News new | ask | show | jobs
by mgsk 1223 days ago
What does this add this isn't already right there in the documentation?
3 comments

It draws attention to a problem that a lot of people have created for themselves by not reading the documentation (or not recalling it if they read it). I guess the author could have just linked the documentation but then they couldn't have added the additional context of the github search demonstrating how common it is.
I must have looked through the docs for create_task a dozen times while trying to figure out how async/await works in Python but still managed to overlook this part.
That is unsurprising. It was first added as a brief note only in 3.9, and expanded to its present length only in 3.10.
Same.
The author doesn't go into much detail on that point: this warning should be present in documentation of many Python libraries that use create_task and return the result to the user unless that library stores those tasks in a collection as is recommended -- at which point the library author had better roll their own garbage collection!
If there was nothing to add then there wouldn’t be loads of projects on GitHub making exactly this mistake.