Opened 7 years ago

Closed 7 years ago

#19743 closed enhancement (fixed)

Generic not_equals methods for objects in coding theory library

Reported by: David Lucas Owned by:
Priority: major Milestone: sage-7.0
Component: coding theory Keywords:
Cc: Merged in:
Authors: David Lucas Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: f55e892 (Commits, GitHub, GitLab) Commit: f55e8927c4dd36224f2aa56bbfd2f790641a2243
Dependencies: Stopgaps:

Status badges

Description (last modified by David Lucas)

In this ticket, we propose a default implementation of __ne__ methods for AbstractLinearCode, Encoder and Decoder classes, which means one will only need to implement __eq__ in the subclasses.

This new __ne__ simply returns the inverse of the return value of __eq__.

Change History (9)

comment:1 Changed 7 years ago by David Lucas

Type: PLEASE CHANGEenhancement

comment:2 Changed 7 years ago by David Lucas

Branch: u/dlucas/default_not_equals_for_linear_codes

comment:3 Changed 7 years ago by David Lucas

Commit: 490f739b55e463543aa8aeb9d1b0189fdad9c718
Description: modified (diff)
Status: newneeds_review

I removed the old implementation of __ne__ in, created generic implementation for the top classes Decoder, Encoder and AbstractLinearCode and implemented __eq__ for encoders in

This is now open for review.

New commits:

490f739Removed old __ne__ methods, implemented generic __ne__ in Decoder, Encoder and AbstractLinearCode

comment:4 Changed 7 years ago by Vincent Delecroix

Better use not self == other as it is faster and more flexible. The only reason to not do so is if your equality might return NotImplemented.

comment:5 Changed 7 years ago by Jeroen Demeyer

Status: needs_reviewneeds_work

I agree with 4: avoid a.__eq__(b) unless you have a good reason for it.

comment:6 Changed 7 years ago by git

Commit: 490f739b55e463543aa8aeb9d1b0189fdad9c718f55e8927c4dd36224f2aa56bbfd2f790641a2243

Branch pushed to git repo; I updated commit sha1. New commits:

f55e892Changed not a.__eq__(b) to not a == b in generic __ne__ methods

comment:7 Changed 7 years ago by David Lucas

Status: needs_workneeds_review

Thanks for the advice!

I changed my code accordingly.


comment:8 Changed 7 years ago by Vincent Delecroix

Reviewers: Vincent Delecroix
Status: needs_reviewpositive_review

comment:9 Changed 7 years ago by Volker Braun

Branch: u/dlucas/default_not_equals_for_linear_codesf55e8927c4dd36224f2aa56bbfd2f790641a2243
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.