On 23/03/22 11:44 am, Rathmann wrote:
So that sounds like the original CPython implementation had an
O(depth) component, but with a lower constant factor than the current
version?
Yes, but so much lower that I would expect it to be unmeasurable.
--
Greg
--
https://mail.python.org/mailman/list
> On 19 Mar 2022, at 03:07, Greg Ewing wrote:
>
> On 19/03/22 9:40 am, Rathmann wrote:
>> The other challenge/question would be to see if there is a way to implement
>> this basic approach with lower overhead.
>
> My original implementation of yield-from didn't have this problem,
> because it did
> On 19 Mar 2022, at 03:07, Greg Ewing wrote:
>
> On 19/03/22 9:40 am, Rathmann wrote:
>> The other challenge/question would be to see if there is a way to implement
>> this basic approach with lower overhead.
>
> My original implementation of yield-from didn't have this problem,
> because it
On Sat, 19 Mar 2022 at 14:06, Greg Ewing wrote:
>
> On 19/03/22 9:40 am, Rathmann wrote:
> > The other challenge/question would be to see if there is a way to implement
> > this basic approach with lower overhead.
>
> My original implementation of yield-from didn't have this problem,
> because it
On 19/03/22 9:40 am, Rathmann wrote:
The other challenge/question would be to see if there is a way to implement
this basic approach with lower overhead.
My original implementation of yield-from didn't have this problem,
because it didn't enter any of the intermediate frames -- it just
ran down
On Friday, March 18, 2022 at 2:07:45 AM UTC-7, Antoon Pardon wrote:
> Op 18/03/2022 om 04:14 schreef Rathmann:
> >
> > So what do people think of this hack/technique? Is it
> >
> > A) A terrible idea? (Please be specific.)
> > B) Already well-known (and I just missed it.)
> > C) Potentially
Op 18/03/2022 om 04:14 schreef Rathmann:
...
```python
def recursive_generator_driver(g):
"""g is a generator object, which is likely to call other generators"""
stack = [g]
while True:
g = stack[-1]
try:
val = next(g)
if isinstance(val,
Summary: I am looking for feedback on a potential technique for coding
recursive generators.
Often times the most convenient algorithms for creating a sequence of
results are recursive, while the most convenient interface for the
consumption of those results is an iterator. PEP 380 introduced the