On Jan 21, 10:57 pm, Martin Drautzburg <[email protected]>
wrote:
> 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.
--
Mark
--
http://mail.python.org/mailman/listinfo/python-list