Guido van Rossum wrote: > On 3/7/06, Georg Brandl <[EMAIL PROTECTED]> wrote: >> > Have you even tried to define precise semantics for any of those, like >> > the expansion of "with E as V: B" in PEP 343? >> >> Easily. >> >> if expr as name: >> BLOCK >> >> would be equivalent to >> >> name = expr >> if name: >> BLOCK >> del name > > You need to be a little more formal. What happens when there are elif > or else clauses? Why the del at all? (with doesn't delete VAR). > > You also need to present a better motivation. What would be the point > of having a separate name for the value True or False when you already > know its value based on which branch you execute? And what exactly is > the big savings? If you look at the motivation for with E as V, V is > *not* assigned the value of E (but rather E.__context__().__enter__()) > and the with statement as a whole has a very good reason for its > existence. Your proposal here lacks that.
Thinking over it, this is too much a difference between the with-"as" and my "as", so I'm abandoning this idea. My "as" would just have been a shortcut to avoid writing longish expressions that have to be checked for true-ness and then tinkered with. >> Same for while. > > You aren't really trying, are you? No ;) I would have written a PEP anyway. Cheers, Georg _______________________________________________ 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