nonlocal fails ?

Random832 random832 at fastmail.com
Fri Nov 15 12:21:37 EST 2019


On Fri, Nov 15, 2019, at 11:47, Richard Damon wrote:
> The issue with calling it a Reference, is that part of the meaning of a
> Reference is that it refers to a Object, and in Python, Names are
> conceptually something very much different than an Object. Yes, in the
> implementation details, a name is basically a dictionary entry, so it
> could be done, the question is should it.

C# has basically the same issue and does fine calling its thing 'ref'. But that's not really the point - my point was that the concept of being able to have a function change the value of a variable specified by its caller doesn't magically cease being applicable just because the value is a "reference" and the variable is a "name binding".

[Similarly, the fact that values are "references" to mutable objects doesn't mean that python, or Java or C#, isn't call-by-value. The value is the "reference" itself, the fact that it can be used to change data that exists elsewhere is beside the point.]


More information about the Python-list mailing list