Guido van Rossum <[EMAIL PROTECTED]> writes:

> Apologies if this has been discovered and rejected already; I've had
> to skip most of the discussions but this though won't leave my head...
>
> So PEP 310 proposes this:
>
>         with VAR = EXPR:
>             BLOCK
>
> translated to
>
>         VAR = EXPR\
>       if hasattr(VAR, "__enter__"):
>           VAR.__enter__()
>       try:
>           BLOCK
>       finally:
>             VAR.__exit__()
>
> This equates VAR with the value of EXPR. It has a problem: what if
> inside BLOCK an assignment to VAR is made -- does this affect the
> finally clause or not? I think that the finally clause should use an
> internal variable that isn't affected by assignments to VAR.

Uh, if that's not clear from the PEP (and I haven't looked) it's an
oversight.  VAR is optional in PEP 310, after all.

Cheers,
mwh

-- 
  There's an aura of unholy black magic about CLISP.  It works, but
  I have no idea how it does it.  I suspect there's a goat involved
  somewhere.                     -- Johann Hibschman, comp.lang.scheme
_______________________________________________
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

Reply via email to