[issue32486] tail optimization for 'yield from'

2018-01-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

The original yield from implementation did something like this, but we dropped 
it because it caused debuggability problems. See #14230

--
nosy: +benjamin.peterson
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32486] tail optimization for 'yield from'

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  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 
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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32486] tail optimization for 'yield from'

2018-01-04 Thread Brett Cannon

Change by Brett Cannon :


--
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32486] tail optimization for 'yield from'

2018-01-04 Thread Brett Cannon

Change by Brett Cannon :


--
type: resource usage -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32486] tail optimization for 'yield from'

2018-01-03 Thread Robert Smart

New submission from Robert Smart :

When a generator procedure ends with "yield from" it would be nice if this was 
handled efficiently (just replace the generator with the new source). Because 
it is natural to push things back into a generator with

def prependGen(hd,tl):
yield hd
yield from tl

--
messages: 309407
nosy: Robert Smart
priority: normal
severity: normal
status: open
title: tail optimization for 'yield from'
type: resource usage
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com