[Python-ideas] Re: Add timeout parameter to Synchronization Primitives in asyncio

2021-09-19 Thread Blue
This is already supported with [`asyncio.wait_for()`]( https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for). For example: `await asyncio.wait_for(asyncio.Event().wait(), timeout=60)` ___ Python-ideas mailing list -- python-ideas@python.o

[Python-ideas] Add timeout parameter to Synchronization Primitives in asyncio

2021-09-19 Thread Andres Torres
It would be very nice if the [Synchronization Primitives](https://docs.python.org/3/library/asyncio-sync.html) had a timeout parameter just like the [analogous classes](https://docs.python.org/3/library/threading.html#condition-objects) do in the threading module. Thank you for your considerat

[Python-ideas] Re: Otherwise clause in for statement to run when a empty iterable is used

2021-09-19 Thread Ricky Teachey
On Sun, Sep 19, 2021, 6:42 PM Andre Delfino wrote: > Your code has an unpacking error in the first line. I think you mean this, > right? > > no_items = object() > item = no_items > > for item in get_items(): > frob(item) > > if item is no_items: > raise ValueError() > Sorry yes. Actually

[Python-ideas] Re: Otherwise clause in for statement to run when a empty iterable is used

2021-09-19 Thread Andre Delfino
Your code has an unpacking error in the first line. I think you mean this, right? no_items = object() item = no_items for item in get_items(): frob(item) if item is no_items: raise ValueError() ___ Python-ideas mailing list -- python-ideas@pyt

[Python-ideas] Re: A better math.factorial

2021-09-19 Thread Stephen J. Turnbull
Chris Angelico writes: > Though factorials, in my experience, are far more commonly a > demonstration of recursion than any sort of actual utility. I honestly > cannot think of a single time when I've wanted to reach for a standard > library factorial function. I gather you've never accumulat