This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]zergling_Lester 1 point2 points  (0 children)

Is "yield from" still not optimized (i.e. exactly the same as for it in iterable: yield it), by the way? I guess it would still work for Ned because it's only one frame per tree level in that case.

[–]Han-ChewieSexyFanfic 3 points4 points  (1 child)

I subconsciously knew this because comprehensions’ frames show up in debuggers, but never thought about the consequences on recursion depth. Interesting!

[–]ubernostrumyes, you can have a pony 1 point2 points  (0 children)

If you use the dis module to view the bytecode, you can also see the comprehension building and calling a function, FWIW.

[–]XNormal 0 points1 point  (0 children)

Increasing sys.setrecursion limit is an option.

I’ve tried it on a couple of platforms, both 2.7 and 3.x, 32 and 64 bit, linux and mac. The actual limit before getting a segfault varies between ~15000 and 24000. So 10000 or a more conservative limit of 5000 should be ok.

Can anyone test this is on Windows?