On 2/23/06, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 2/22/06, Almann T. Goo <[EMAIL PROTECTED]> wrote: > > def incrementer_getter(val): > > def incrementer(): > > val = 5 > > def inc(): > > ..val += 1 > > return val > > return inc > > return incrementer > > Sorry, what way did the user think? I'm not sure what you think was > supposed to happen.
My apologies ... I shouldn't use vague terms like what the "user thinks." My problem, as is demonstrated in the above example, is that the implicit nature of evaluating a name in Python conflicts with the explicit nature of the proposed "dot" notation. It makes it easier for a user to write obscure code (until Python 3K when we force users to use "dot" notation for all enclosing scope access ;-) ). This sort of thing can be done today with code using attribute access on its module object to evaluate and rebind global names. With the "global" keyword however, users don't have to resort to this sort of trick. Because of Python's name binding semantics and the semantic for the "global" keyword, I think the case for an "outer"-type keyword is stronger and we could deprecate "global" going forward in Python 3K. One of the biggest points of contention to this is of course the backwards incompatibility with a new keyword ... Python has already recently added "yield" and we're about to get "with" and "as" in 2.5. As far as the "user-interface" of the language getting bloated, I personally think trading "global" for an "outer" mitigates that some. -Almann -- Almann T. Goo [EMAIL PROTECTED] _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com