Guido> At the same time, having to use it as follows: Guido> for f in with_file(filename): Guido> for line in f: Guido> print process(line) Guido> is really ugly, so we need new syntax, which also helps with Guido> keeping 'for' semantically backwards compatible. So let's use Guido> 'with', and then the using code becomes again this: Guido> with f = with_file(filename): Guido> for line in f: Guido> print process(line) How about deferring major new syntax changes until Py3K when the grammar and semantic options might be more numerous? Given the constraints of backwards compatibility, adding more syntax or shoehorning new semantics into what's an increasingly crowded space seems to always result in an unsatisfying compromise. Guido> Now let me propose a strawman for the translation of the latter Guido> into existing semantics. Let's take the generic case: Guido> with VAR = EXPR: Guido> BODY What about a multi-variable case? Will you have to introduce a new level of indentation for each 'with' var? Skip
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