Aliasing causes side effects in mutable objects! However, if an object is immutable, like a string, these side effects don't occur (since the object can't be changed anyway!). What gets printed out here? →
And if Aliasing Was Not the Intention
If you'd like to make a new list rather than refer to the same list (that is have each variable point to a different object - though two equal objects)…
…you can use list slicing, which always gives back a new list. Creating a new list that is equivalent to, but a different object from the original, is called cloning.
Cloning
You can slice out the entire list to clone a list from the start index (0) to end index (len(list_of_elements) - 1):
Alternatively, there's shortcut to slicing out the whole string (without having to deal with precise start and end indexes)…
Just leave out the start and end (m, n) index from the slice.
And What About Functions?
When parameters are passed to functions the value is a reference! What will this code print out? →
Changes made to a mutable object that's an argument to a function can be seen both within and outside of the function (all refer to the same object!). →
The following function finds the largest integer in a list of integers, but it inadvertently sorts the original.