Creating a local variable scope.

Ethan Furman ethan at
Sat Sep 12 17:02:35 CEST 2009

Daniel Stutzbach wrote:
> On Fri, Sep 11, 2009 at 8:29 PM, Steven D'Aprano 
> <steve at 
> <mailto:steve at>> 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.

That's probably why he called it as:

with do_nothing() as *imaginary*_local_scope:
     del spam, eggs, imaginary_local_scope

and then as the last item deleted all the variables, except the one he 
wanted to keep.


More information about the Python-list mailing list