Eric Snow <ericsnowcurren...@gmail.com> added the comment: Interesting thought, the syntax seems unnecessary. Adding new syntax to the language is something that happens rarely and only with a _lot_ of consideration.
As a slightly more verbose alternative, currently you can do this: def fail_if_defined(*args, namespace): for name in args: if name in namespace: raise AlreadyBoundError(name) And in your code you would put the following where you cared about it: fail_if_defined("FILE", "header", namespace=locals()) You could even drop the namespace parameter (since it's sort of boilerplate): def fail_if_defined(*args): namespace = inspect.currentframe().f_back.f_locals for name in args: if name in namespace: raise AlreadyBoundError(name) However, if you are going to the trouble of sticking those in place (or of selectively using a new syntax), you are likely paying attention to the the situation already, rendering either solution unnecessary. Ultimately, this is something better addressed instead by keeping your functions small, by being a little more cautious in naming, and particularly by careful unit testing. ---------- nosy: +eric.snow _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13678> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com