Coming from an imperative programming background, it comes as a surprise that the assignment operator "=" makes two variable names point to the same place in memory rather than copying the value in memory from one unique object to another. This pattern shows up both in native data types, such as lists, but also classes defined with the 'class' keyword. I do, however, notice an exception to this rule:
a = 2
if id(a) == id(2):
print "The id function returns the object's address in memory."
a = 3
if id(a) != id(2):
print "The hardcoded integer '2' does not get its address in memory re-assigned to that of 3"
Both of these if conditions are met. It is necessary that they do, or else the construction of the natural numbers would break down. Is there any way that I can leverage this const-ness in classes that I define? I would like for some classes to be less like a "ln -s" and more like a "cp".