Computer Science Ph.D. student Isaac Griffith will give today's
lecture. John is attending a conference.
- Shallow Equality occurs when two variables refer to the
same object in the computer's memory. The python keyword is
tests for shallow equality.
- Deep Equality occurs when either there is shallow
equality OR two variables refer to objects
that contain the same underlying (significant) values.
- The method __add__(self, other) can be defined so that
the operator + can be used.
- Consider dungeons.py.
- Draw a picture that demonstrates shallow equality of two Humans.
- Modify the program above to demonstrate your understanding of shallow
equality using the Python keyword is.
- Draw a picture that demonstrates deep equality of two Humans.
- Modify the program above to add a function that illustrates
your understanding of deep equality.
- Modify fraction.py to use
method __add__(self, other_fraction) instead of method