Nick Coghlan wrote:
I'm OK with a target scope declaration construct having lexical-scope-dependent behaviour - exactly what "nonlocal NAME" will do depends on both the nature of the current scope,
Yes, but my point is that having an explicit "parentlocal" scope declaration doesn't help to make anything more orthogonal, because there's no way it can have *exactly* the same effect as a comprehension's implicit parent-local scoping. In other words, taking a comprehension and manually expanding it into a function with parentlocal declarations wouldn't give you something exactly equivalent to the original. If that's the purpose of having an explicit parentlocal, then it fails at that purpose. If that's *not* the purpose, then I'm not really sure what the purpose is, because I can't think of a situation where I'd choose to use parentlocal instead of nonlocal with an explicit assignment in the outer scope. Except maybe for the class-scope situation, which seems like an extremely obscure reason to introduce a whole new scoping concept with its own keyword. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com