Finding the instance reference of an object

Joe Strout joe at strout.net
Wed Oct 29 21:13:09 EDT 2008


On Oct 29, 2008, at 4:52 PM, Fuzzyman wrote:

> You're pretty straightforwardly wrong. In Python the 'value' of a
> variable is not the reference itself.

That's the misconception that is leading some folks around here into  
tangled nots of twisty mislogic, ultimately causing them to make up  
new terms for what every other modern language is perfectly happy  
calling Call-By-Value.

I've thought a lot about why this misconception is so widespread here,  
and I think it must be one of the following:

1. There was one community leader with this idea, who has been  
successful at promoting it widely, much to the detriment of all; or,

2. Because everything in Python is an object, you're not forced to  
think clearly (and more generally) about references as values as you  
are in languages (such as Java, VB.NET, etc.) which have both simple  
types and object types.

Either way, it's wrong (or at least, a needlessly complicated way of  
looking at things).

> .NET does draw a distinction between 'value types' and reference types
> - where using reference types are called by reference (the reference
> is passed) and value types are called by value (the value itself is
> copied).

Quite right.  Now, note that "ByRef" and "ByVal" apply to both.   
Generalize to Python.  There you go.

Best,
- Joe

P.S. I really am trying to quit responding to this thread.  Sometimes  
the urge is too strong.  But I'll keep trying!




More information about the Python-list mailing list