Nicolas Fleury <[EMAIL PROTECTED]> writes:

> What about making the ':' optional (and end implicitly at end of current 
> block) to avoid over-indentation?
>
> def foo():
>     with locking(someMutex)
>     with opening(readFilename) as input
>     with opening(writeFilename) as output
>     ...

How about this instead:

with locking(mutex), opening(readfile) as input:
    ...

So there could be more than one expression in one with.

> would be equivalent to:
>
> def foo():
>     with locking(someMutex)
>         with opening(readFilename) as input
>             with opening(writeFilename) as output
>                 ...

The thing is that with normal try-finally block, you can add more
things to it easily. This kind of with thing does not allow adding
more stuff to it in any other way than adding more indentation.

Anyway, I like the idea of the PEP too.

-- 
Ilpo Nyyssönen # biny # /* :-) */
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to