On Sat, Nov 8, 2008 at 12:37 AM, Bruce Leban <bruce@leapyear.org> wrote:
There *is* one guaranteed way of ensuring that I can't use a variable's value: leaving it unbound. That is, to support this, we would add a new syntax something like what George proposed with slightly different semantics:def foo(x, y=__unbound__):where if y is omitted from the call, then y is unbound. This is slightly different than what would happen if y were left out of the parameter list as in that case, y could reference a global of the same name. In this case, y can only reference an unbound local.No other changes are required to use this. If I don't check whether or not y is bound, then I'll get a NameError when I try to use it, just as with any other unbound variable.
If this proposal were to be seriously considered, there are of course alternative syntaxes that could be considered, like using missing, __missing__ or def foo(x, ?y) but that's getting ahead.