FWIW, I prefer Fredrik's wish too. Alex On Sat, May 2, 2009 at 12:26 PM, Fredrik Johansson < fredrik.johans...@gmail.com> wrote:
> On Sat, May 2, 2009 at 9:01 PM, Georg Brandl <g.bra...@gmx.net> wrote: > > Hi, > > > > this is just a short notice that Mattias Brändström and I have finished a > > patch to implement the previously discussed and mostly warmly welcomed > > extension to with's syntax, allowing > > > > with A() as a, B() as b: > > > > to be written instead of > > > > with A() as a: > > with B() as b: > > > > This syntax was chosen (over "with A(), B() as a, b:") because it has > more > > syntactical similarity to the written-out version. Also, our current > uses > > of "as" all have only one expression on the right. > > > > The patch implements it as a simple AST transformation, which guarantees > > semantic equivalence. It is at <http://codereview.appspot.com/53094>. > > > > If there is no strong opposition, I will commit it and port it to py3k > > before 3.1 enters beta stage. > > > > cheers, > > Georg > > I was hoping for the other syntax in order to be able to create a > nested context in advance as a simple tuple: > > with A, B: > pass > > context = A, B > with context: > pass > > (I.e. a tuple, or perhaps any iterable, would be a valid context manager.) > > With the syntax in the patch, I will still have to implement a custom > nesting context manager to do this, which sort of defeats the purpose. > > Fredrik > _______________________________________________ > 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/aleaxit%40gmail.com >
_______________________________________________ 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