On Nov 8, 2008, at 2:38 PM, Terry Reedy wrote:

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."

Hey now, hang on. That doesn't characterize my argument at all. My argument is much simpler:

Python's call semantics are exactly the same as other modern OOP languages, where it is commonly called call-by-value (and it is, in fact, call-by-value, as you can see with the simple test of assigning to the formal parameter). Therefore, we would reduce confusion if we'd get on board and call it that in Python, too.

Of course, I've softened my position somewhat, since being shown that "call by sharing" is simply a term for call-by-value in the case where the values are object references. That clearly does apply to Python (as well as other OOP languages, where object references are involved), and as long as we can explain it as just a restricted form of call-by-value, I'm OK with that.

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.

Which languages? Certainly none of those at <http://www.strout.net/info/coding/valref/ >. (Except that some of them have a by-reference option, which Python and Java do not.)

Best,
- Joe

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to