Opened 14 years ago

Closed 13 years ago

# [is duplicate?] graphs: Implement __eq__ and __neq__ rather than __cmp__

Reported by: Owned by: jason was trivial sage-2.8.9 combinatorics graphs

### Description

The rich comparison operators eq and neq are preferred in Python. See http://docs.python.org/ref/customization.html

### comment:1 Changed 14 years ago by mabshoff

• Milestone set to sage-2.9

### comment:2 Changed 13 years ago by rlm

• Resolution set to invalid
• Status changed from new to closed

This is actually crucial in the graph_isom code: there, not just equality comparison, but actually finding which graph is smaller is important. There is a specific enumeration of graphs coded, and under that enumeration, cmp gives exactly what it means. This method cannot be removed.

### comment:3 Changed 13 years ago by mabshoff

• Milestone changed from sage-2.9 to sage-2.8.9

Please do not close tickets unless explicitly asked to do so. You can recommend to close a ticket.

Cheers,

Michael

### comment:4 Changed 13 years ago by mabshoff

• Resolution invalid deleted
• Status changed from closed to reopened

### comment:5 Changed 13 years ago by mabshoff

• Summary changed from graphs: Implement __eq__ and __neq__ rather than __cmp__ to [is invalid] graphs: Implement __eq__ and __neq__ rather than __cmp__

### comment:6 Changed 13 years ago by rlm

• Summary changed from [is invalid] graphs: Implement __eq__ and __neq__ rather than __cmp__ to [is duplicate?] graphs: Implement __eq__ and __neq__ rather than __cmp__

Actually, I was wrong on two counts - count 1, the graph_isom code actually re-implements the enumeration, so it doesn't actually depend on cmp, and count 2, you're right about rich comparison, but instead of just eq and neq, there should also be lt, le, etc. However, this would all be part of an overhaul on how graph enumeration is done in general, so this could be part of ticket #749.

### comment:7 Changed 13 years ago by malb

• Resolution set to duplicate
• Status changed from reopened to closed

This is duplicate because #749 takes care of it.

Note: See TracTickets for help on using tickets.