Guido van Rossum wrote:

> PEP 340 redux
> =============
>
> Syntax:
> do EXPR [as VAR]:
>     BLOCK
>
> Translation:
> abc = EXPR
> [VAR =] abc.__enter__()
> try:
>     BLOCK
> finally:
>     abc.__exit__(*"sys.exc_info()") # Not exactly
>
> Pros:
> - can use a decorated generator as EXPR
> - separation of EXPR and VAR (VAR gets what EXPR.__enter__() returns)
>
> Cons:
> - slightly less simple (__enter__ must return something for VAR;
>   __exit__ takes optional args)

what happened to the original "yield the target object" solution?  or did
I just dream that?

</F>



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to