Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#9004 closed defect (duplicate)

__cmp__ in sage/sets/set.py doesn't do what it's supposed to do.

Reported by: fbissey Owned by: AlexGhitza
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: algebra Keywords:
Cc: Merged in:
Authors: François Bissey Reviewers: Minh Van Nguyen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

According to the comments in the code:


Compare self and right.

If right is not a Set compare types. If right is also a Set, returns comparison on the underlying objects.


But that is not what is currently done. In the case where right is not a Set (more accurately a "Set_object" that's possibly another issue) the following is evaluated:

cmp(type(right), type(Set_object))

The correct thing would be to compare type(right) with the type "Set_object" [which is type(self)] not the type of Set_object.

Patch to follow.

Attachments (1)

trac9004.patch (693 bytes) - added by fbissey 11 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by fbissey

comment:1 Changed 11 years ago by mvngu

  • Authors set to Francois Bissey
  • Status changed from new to needs_review

comment:2 Changed 11 years ago by mvngu

  • Reviewers set to Minh Van Nguyen
  • Status changed from needs_review to positive_review

Looks good to me.

comment:3 Changed 11 years ago by was

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

This patch was still wrong, since it was backwards still. See #9121 which is basically the same.

comment:4 Changed 11 years ago by mvngu

  • Milestone changed from sage-4.4.4 to sage-duplicate/invalid/wontfix

comment:5 Changed 5 years ago by chapoton

  • Authors changed from Francois Bissey to François Bissey
Note: See TracTickets for help on using tickets.