Finding the instance reference of an object

Steve Holden steve at holdenweb.com
Thu Oct 30 00:50:26 EDT 2008


Joe Strout wrote:
> 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 tried hard to make myself believe that the above was a clever pun and
knot [sic] a typo. Sadly I failed.

> 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.
> 
How about

3. You just hate being wrong.

> Either way, it's wrong (or at least, a needlessly complicated way of
> looking at things).
> 
One that has apparently served for almost twenty years now.

>> .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!
> 
We must tax your patience dreadfully. I have suffered from the same
myself, but I fear we are doomed to pursue each other until Godwin's law
releases us.

Which reminds me, had you thought about submitting a paper along these
lines to PyCon? If we meet at PyCon at least let me buy you a pint to
show there are no hard feelings.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list