Chapter 12. Generated Compare Methods

The -compare or -gencomparecommand line option causes an __eq__ method to be added to relevant generated classes. The presence of this method allows the Pyton equality operators to be used to compare instances of generated objects.

For example, if your program has two instances of the generated PersonnelRecord class, named pr1 and pr2, the two instances can be compared for equality using this line:

   if pr1 == pr2: