Professional Documents
Culture Documents
If getStudents returned self.students, the second line of code would have the
(probably unexpected) side effect of changing the set of students in course1.
The instance variable isSorted is used to keep track of whether or not the list of
students has been sorted since the last time a student was added to it. This
allows the implementation of getStudents to avoid sorting an already sorted list.
Figure 8.6 contains a function that uses class Grades to produce a grade report
for some students taking 6.00, the MIT course for which this book was
developed.