On 10/25/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Paul Moore wrote: [...] > > Has the option of letting the with statement admit multiple context > > managers been considered (and presumably rejected)? [...] > Not rejected - deliberately left as a future option (this is the reason why > the RHS of an as clause has to be parenthesised if you want tuple unpacking).
Thanks. I now see that note in the PEP - apologies for missing it in the first instance. [...] > The issue with that implementation is that the semantics are wrong - it > doesn't actually mirror *nested* with statements. If one of the later > __enter__ methods, or one of the first-executed __exit__ methods throws an > exception, there are a lot of __exit__ methods that get skipped. > > Getting it right is more complicated (and this probably still has mistakes): Bah. You're right, of course (about it being more complicated - I can't see any mistakes :-)) I'd argue that precisely because a naive approach gets it wrong, having your version as an example in the PEP (and possibly the documentation, much like the itertools module has a recipes section) is that much more useful. Anyway, thanks for the help. Paul. _______________________________________________ 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