Finding the instance reference of an object

Terry Reedy tjreedy at udel.edu
Sat Nov 8 16:38:56 EST 2008


greg wrote:
> Joe Strout wrote:

> Something has just occurred to me. If you take the
> view that the value of an expression is an object,
> then the terms "value" and "object" are synonymous.

Nope.  The result of an expression is an object with an id, class, and 
'value', where 'value' can include attributes (other than class) or 
non-attribute content or both.  The distinction does not matter much for 
immutables but it definitely does for mutable objects.

> So if you then insist that Python uses "call by object",
> you're actually saying it uses call by value!

Both Joe and you seem to be engaging in the following bit of sophistry:

"In order for code A to call code B, some information must be 
communicated from A to B."  Something we all know ...

"That information is a value of some sort." True...

"Therefore all calling is calling by value."

Well, yes, if you insist.  *But*, a distinction that does not 
distinguish is useless.  One might as well say "Calling is calling."

In order to successfully program in Python, one must understand how 
functions are called.  That 'how' is distinct from the 'how' of some 
other languages.  Therefore, some of us claim, that 'how' should have a 
distinct name.

Terry Jan Reedy





More information about the Python-list mailing list