The meaning of a = b in object oriented languages

Gabriel Genellina gagsl-py2 at
Tue Sep 18 09:34:24 CEST 2007

En Tue, 18 Sep 2007 03:57:36 -0300, Summercool <Summercoolness at>  

> i think the line
> a = "different"
> means a is now set to a pointer to the String object with content
> "different".
> or that "a is now a reference to the String object."
> and b is still a reference to the Array object.  so that's why a and b
> print out different things.  they point to different objects.
> i think:
> whenever in Ruby, Python, and Java,
> a is never an object.  a is always a "reference to an object"...  this
> will solve a lot of puzzles when we don't understand some code
> behaviors.

Yes, but extrapolating that to "In OOPL, a=b just copies a reference" is  
"Old" languages like Fortran use the "boxed" model, and "modern" languages  
tend to use the "reference" model, and since OO languages are younger...
But this rather old post by Alex Martelli explains it better  

Gabriel Genellina

More information about the Python-list mailing list