python-trio / python-trio/trio

Is it better to have sleep(0), sleep(x), sleep(inf), or checkpoint(), sleep(x), sleep_forever()?

Open
#310 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

design discussion potential API breaker
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

Speaking of cleaning up names and namespaces, sleep_forever is also accessible as sleep(inf) or sleep_until(inf). Does it really need a top-level name? And frankly the sleep_forever name is kinda confusing – wouldn't wait_cancelled or something make more sense?

Maybe we should make it so the inf versions of sleep special case this for the marginal efficiency gain (like sleep(0) does), and then make that the One Way of getting these semantics.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing sleep(0), sleep(x), sleep(inf), sleep_until(inf), and sleep_forever entry points. Determine whether the proposal should unify the infinite-sleep semantics, remove or rename the top-level API, or retain the current alternatives. Done requires a decided API direction and agreement on its naming and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.