
2.16 Python Programming: A Modern Approach
The syntax provides useful type of information; the square brackets indicate that this
is a list. The parentheses indicate that the elements of the list are tuples.
2.4.4 Aliasing and Copying
Because the dictionaries are mutable, you need to be aware of aliasing. Whenever two
variables refer to the same object, the changes that occur affect the other. If you want to
modify a dictionary and keep a copy of the original, use the copy method. For example,
opposites is a dictionary that contains pairs of opposites:
alias.py
opposites = {'up': 'down', 'right': 'wrong', 'true':
'false'}
alias = opposites
copy ...