

PEP 380 ("yield from") is now Final - motter
http://mail.python.org/pipermail/python-dev/2012-January/115471.html

======
motter
Full details: <http://www.python.org/dev/peps/pep-0380/>

~~~
sp332
Talk about syntactic sugar :)

    
    
        RESULT = yield from EXPR
    

_is semantically equivalent to_

    
    
      _i = iter(EXPR)
      try:
        _y = next(_i)
      except StopIteration as _e:
        _r = _e.value
      else:
        while 1:
            try:
                _s = yield _y
            except GeneratorExit as _e:
                try:
                    _m = _i.close
                except AttributeError:
                    pass
                else:
                    _m()
                raise _e
            except BaseException as _e:
                _x = sys.exc_info()
                try:
                    _m = _i.throw
                except AttributeError:
                    raise _e
                else:
                    try:
                        _y = _m(*_x)
                    except StopIteration as _e:
                        _r = _e.value
                        break
            else:
                try:
                    if _s is None:
                        _y = next(_i)
                    else:
                        _y = _i.send(_s)
                except StopIteration as _e:
                    _r = _e.value
                    break
      RESULT = _r

~~~
motter
Kudos for typing that out for the purposes of illustration!

~~~
sp332
Well I just copy&pasted from the article :) But it's impressive! definitely
props to whoever came up with it.

