For review: PEP 343: Anonymous Block Redux and Generator Enhancements

Kent Johnson kent37 at tds.net
Sat Jun 4 05:40:25 EDT 2005


Robin Becker wrote:
> Ilpo Nyyssönen wrote:
>>
>> with locking(mutex), opening(readfile) as input:
>>     ...
> 
> with EXPR as x:
>      BLOCK
> 
> EXPR can be a tuple so the above would be ambiguous.

I don't think EXPR can be a tuple; the result of evaluating EXPR must have __enter__() and __exit__() methods. *x* can be a tuple.

Kent



More information about the Python-list mailing list