[Python-Dev] 'With' context documentation draft (was Re: Terminology for PEP 343

Michael Hudson mwh at python.net
Fri Jul 8 13:57:28 CEST 2005


Walter Dörwald <walter at livinglogic.de> writes:

> Michael Hudson wrote:
>
>> Walter Dörwald <walter at livinglogic.de> writes:
>> [...]
>>>I.e. will VAR still exist after the end of the block with its value
>>>the return value of __enter__() or will it revert to the previous
>>>value (if any)?
>> 
>> Eh, no.  Where would you store the old value?
>
> I don't know, where does:
>
>  >>> x = 42
>  >>> "".join(chr(x) for x in xrange(10))
> '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t'
>  >>> x
> 42
>
> store it?

In a new frame, AIUI.

You'll get a different answer for a list comprehension, as I'm sure
you know.

Cheers,
mwh

-- 
  I sense much distrust in you.  Distrust leads to cynicism, cynicism
  leads to bitterness, bitterness leads to the Awareness Of True
  Reality which is referred to by those-who-lack-enlightenment as
  "paranoia".  I approve.    -- David P. Murphy, alt.sysadmin.recovery


More information about the Python-Dev mailing list