-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed as not planned
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
This renaming was proposed on Discourse as a solution for the annoyance that two very similar names exist and both can be used in the same statement without any error, because both are async context managers (CM):
async with asyncio.timeout(99): await ... # timeout is using relative time as expected
async with asyncio.Timeout(99): await ... # Timeout is using loop clock absolute time;
# small values are already in the past,
# so it cancels immediatelyIt is very easy to make an error and write the upper-case Timeout by mistake. For instance we already have the upper-case TaskGroup async CM.
Using timeout creates a Timeout object. Because Timeout is not intended to be used directly, giving it a new name and deprecating the old one was suggested in the linked Discourse thread.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/error-prone-naming-asyncio-timeout-vs-asyncio-timeout/104727
gpshead
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Done
Status
Todo