Opened 6 years ago

Closed 6 years ago

#19743 closed enhancement (fixed)

Generic not_equals methods for objects in coding theory library

Reported by: dlucas 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 dlucas)

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 6 years ago by dlucas

  • Type changed from PLEASE CHANGE to enhancement

comment:2 Changed 6 years ago by dlucas

  • Branch set to u/dlucas/default_not_equals_for_linear_codes

comment:3 Changed 6 years ago by dlucas

  • Commit set to 490f739b55e463543aa8aeb9d1b0189fdad9c718
  • Description modified (diff)
  • Status changed from new to needs_review

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

This is now open for review.


New commits:

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

comment:4 Changed 6 years ago by vdelecroix

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 6 years ago by jdemeyer

  • Status changed from needs_review to needs_work

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

comment:6 Changed 6 years ago by git

  • Commit changed from 490f739b55e463543aa8aeb9d1b0189fdad9c718 to f55e8927c4dd36224f2aa56bbfd2f790641a2243

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 6 years ago by dlucas

  • Status changed from needs_work to needs_review

Thanks for the advice!

I changed my code accordingly.

David

comment:8 Changed 6 years ago by vdelecroix

  • Reviewers set to Vincent Delecroix
  • Status changed from needs_review to positive_review

comment:9 Changed 6 years ago by vbraun

  • Branch changed from u/dlucas/default_not_equals_for_linear_codes to f55e8927c4dd36224f2aa56bbfd2f790641a2243
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.