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 _______________________________________________ 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