Steven Bethard wrote: > Can you do the same thing for your proposal? As I understand it you > want some sort of implicitly-defined BLOCK that starts the line after > the with statement and runs to the end of the current block...
Yes. I totally agree with the syntax in the PEP, it provides a necessary feature. I'm just suggesting to make the indentation *optional*, because most of the time it is not necessary. > Do you think the benefit of less indentation outweighs the added > complexity of explaining the construct? I still can't think of a good > way of explaining the semantics you want. If you could provide an > explanation that's simple and as explicit as Guido's explanation in PEP > 343, I think that would help your case a lot. Since the current syntax would be there, the no-indentation syntax can be explained in terms of the indentation syntax: """ To avoid over-indentation, a with-statement can avoid defining a new indentation block. In that case, the end of the with block is the end of the current indentation block. with EXPR as VAR REST OF BLOCK is equivalent to with EXPR as VAR: BLOCK """ What do you think? I fail to see the complexity... > P.S. I think it's a great sign that people are mainly squabbling about > syntax here. More likely than not, Guido's already made his mind up > about the syntax. So, since no one seems to have any real problems with > the semantics, I'm hopeful that we'll get a direct implementation of PEP > 343 in the next Python release. =) It's important to note that nobody is against the PEP syntax. We are only talking about adding things to it (optional indentation, or multiple-as as with import). All these changes can also be made later, so no proposition should slow down the implementation of the PEP. Regards, Nicolas -- http://mail.python.org/mailman/listinfo/python-list