Symbols as parameters?

Mark Dickinson dickinsm at
Fri Jan 22 13:34:06 CET 2010

On Jan 21, 10:57 pm, Martin Drautzburg <Martin.Drautzb... at>
> Here is a complete expample using a decorator, still a bit noisy
> def move(aDirection):
>     print "moving " + aDirection
> #Here comes the decorator
> def scope(aDict):
>     def save(locals):
> [...]

Have you considered making 'scope' a context manager?  Your
modifying-locals hacks could be put into the __enter__ and __exit__
methods, and you'd use the context manager with something like:

with scope():
    # ...
    # use up, down, left, right here

# up, down, left, right no longer defined after the with block exits.


More information about the Python-list mailing list