Andrew Barnert wrote:
in Lisp, if you replace the setf macro,
Okay, maybe Lisp wasn't a good example. In the presence of macros, all bets are off. :-( But at least if you haven't redefined the universe, local bindings in Lisp behave predictably.
If you had code involving “x = 2” that stopped working when you moved it from local to a module init function to the top level ... would you think “That’s ok, x isn’t local, so I wasn’t expecting assignment to mean binding”?
I wouldn't think "x isn't local", because it still *is* local from the point of view of that piece of code.
If we're talking about current Python, I definitely would think something was broken, because assignment to a bare name, in any context, isn't supposed to be able to do anything weird.