Terry J. Reedy <tjre...@udel.edu> added the comment:

I think this should have been first floated on python-ideas list.  One 
objection is the same as for eliminating tail calls in general: it collapses 
tracebacks.

def g1():
    yield from g2()
def g2():
    yield 1/0
for i in g1(): pass

Traceback (most recent call last):
  File "F:\Python\a\tem.py", line 7, in <module>
    for i in g1(): pass
  File "F:\Python\a\tem.py", line 2, in g1
    yield from g2()
  File "F:\Python\a\tem.py", line 5, in g2
    yield 1/0
ZeroDivisionError: division by zero

There was at least some discussion of making 'yield from' internally more 
efficient without actual replacement.  I don't know what the current CPython 
implementation does.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to