From: Bernhard Herzog [mailto:bh@intevation.de] > IMO if you want multiple controllers for a with statement you > should just nest the withs: > > with var1 =3D expr1: > with var2 =3D expr2: > suite To some extent, an important point of the with expression is to simplify the overall control construct, and to reduce the level of nesting needed. Combining the variables was intended to help with this. > This makes the order in which the methods of the varN will be > called obvious. It should be fairly obvious from the combined form too - enter in the order specified, and leave in reverse order. > > In this, any varN can be omitted and a dummy hidden variable > > is used.=20 >=20 > Meaning something like >=20 > with var1, , var3 =3D expr1, expr2, expr3: > suite >=20 > I guess. Urgs. Agreed. I didn't mean that. Originally, I'd specified this as with var1 =3D expr1, var2 =3D expr2, ...: but I switched to parallel the normal multiple assignment idiom. How about with [ var1, var2, ... =3D ] expr1, expr2, ... so that you can omit all or none? That's basically just like a normal tuple assignment. > Nested withs handle this in a cleaner way as well, IMO. Yes, I guess they do. I'll make sure I have this as at least an option in the PEP. I still like the combined form, just because it reduces the tendency to drift towards the right margin. But I'm not convinced it will be important particularly often... Thanks for the comments, Paul.
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