[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Nick Coghlan ncoghlan at gmail.com
Thu Sep 29 23:33:16 CEST 2011

On Thu, Sep 29, 2011 at 5:24 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Are you sure we don't? The ability to persistently re-assign
> the name is not needed to address the main use cases under
> consideration, as I understand them to be. In fact, disallowing
> assignment to the name at all would be fine by me. Hence I
> would be +0 on using 'const' as the keyword.

Fixed references to mutable objects makes 'const' a rather problematic
choice. Besides, if we set the bar at that level of functionality then
documenting some conventions for the status quo (i.e. 'private'
keyword only arguments) is an adequate response.

As Terry noted, there are actually two different features being
discussed in the thread, and they differ according to whether or not
rebinding is supported. By casting the proposal as syntactic sugar for
a particular usage of closures, I'm firmly in the camp that if we
change anything here the updated syntax should support rebinding of
the shared names.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list