FWIW, I prefer Fredrik's wish too. Alex On Sat, May 2, 2009 at 12:26 PM, Fredrik Johansson < fredrik.johansson at gmail.com> wrote: > On Sat, May 2, 2009 at 9:01 PM, Georg Brandl <g.brandl at 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 at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/aleaxit%40gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20090502/817fba0b/attachment.htm>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4