nonlocal fails ?

Richard Damon Richard at Damon-Family.org
Sun Nov 17 07:26:28 EST 2019


On 11/17/19 1:33 AM, Random832 wrote:
> On Fri, Nov 15, 2019, at 13:41, Dennis Lee Bieber wrote:
>> 	C# documents those as something visible to the user at the language
>> level...
>> https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html
>> """
>> Types in Microsoft .Net can be either value type or reference type.
>> """
> I was strictly talking about how reference types work (which are just like python or Java objects), and how that is completely distinct from the "ref" of call-by-reference arguments which are also supported, and that both features coexist just fine in the same language. The existence of value types wasn't really relevant to my point.
>
> I'm not sure if you were left with the impression that you can't have a "ref" argument that points to a variable of reference type (and which does *not* point directly to the object), but that is false.

I am not sure about C#, but in C++, a base language for C#, you can not
take the address of a variable of reference type, if you do, you get the
objected referred to, not the reference. References are essentially
constant pointers, and can not be re-seated to reference another object.

I suppose one way at looking at Python's name binding system (maybe not
entirely accurate) would be to say that all Python names act like
references, but that assignment, rather than being applied to the
referred to object, re-seat the reference to point to the new object. As
such, you can't get a reference to the name, to let one name re-seat
where another name refers to.

-- 
Richard Damon



More information about the Python-list mailing list