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

Robin Becker robin at SPAMREMOVEjessikat.fsnet.co.uk
Sat Jun 4 07:16:02 EDT 2005


Kent Johnson wrote:
> 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

Well perhaps this would fly then. I reread the PEP and it says EXPR is 
arbitrary, but cannot be an expression list so maybe this was already 
considered and rejected.
-- 
Robin Becker



More information about the Python-list mailing list