On Fri, Sep 11, 2009 at 8:29 PM, Steven D'Aprano <
st...@remove-this-cybersource.com.au> wrote:

> (4) Create a "do nothing" context manager allowing you to visually indent
> the block, but otherwise have no effect:
>

"with" doesn't create a new scope.  Observe:

Python 2.6.2 (r262:71600, Apr 15 2009, 07:20:39)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> with open('/dev/null') as f:
...   x = 5
...
>>> x
5

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to