The only people I'd see confused by this are those with significant> C++ experience, where assignment of references does indeed go through> a copy of the object itself.
On Mon, Dec 12, 2011 at 7:59 PM, Masklinn email@example.com wrote:
On 2011-12-12, at 06:11 , Greg Ewing wrote:
Richard Prosser wrote:
It seems to me that the essential problem is that of assignment in general, which (I believe) creates a reference on the LHS to the object on the RHS, I would like to understand the reasoning behind such design decisions but I can't find any 'deep' explanations at present So if you or anyone else can explain exactly why such odditties are implemented I would be grateful.
It's not even a question of "dynamic languages", Java and C# reference types have exactly the same semantics (assignment copies the value part of a type, which is the reference itself).
The only people I'd see confused by this are those with significant C++ experience, where assignment of references does indeed go through a copy of the object itself.
As for rationale, it comes down to something like this: Copying large chunks of data is expensive, so it makes sense to do it only when you really need to. And experience shows that most of the time you *don't* need to copy things.
Of course technically that copy could very well be performed "on write". This would significantly complexify the runtime as well.
Python-ideas mailing list Pythonfirstname.lastname@example.org http://mail.python.org/mailman/listinfo/python-ideas