Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic not_equals methods for objects in coding theory library #19743

Closed
sagetrac-dlucas mannequin opened this issue Dec 18, 2015 · 11 comments
Closed

Generic not_equals methods for objects in coding theory library #19743

sagetrac-dlucas mannequin opened this issue Dec 18, 2015 · 11 comments

Comments

@sagetrac-dlucas
Copy link
Mannequin

sagetrac-dlucas mannequin commented Dec 18, 2015

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__.

Component: coding theory

Author: David Lucas

Branch/Commit: f55e892

Reviewer: Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/19743

@sagetrac-dlucas sagetrac-dlucas mannequin added this to the sage-7.0 milestone Dec 18, 2015
@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Dec 18, 2015

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Dec 18, 2015

comment:3

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

@sagetrac-dlucas

This comment has been minimized.

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Dec 18, 2015

Commit: 490f739

@videlec
Copy link
Contributor

videlec commented Jan 2, 2016

comment:4

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.

@jdemeyer
Copy link
Contributor

jdemeyer commented Jan 3, 2016

comment:5

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 5, 2016

Changed commit from 490f739 to f55e892

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 5, 2016

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

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

@sagetrac-dlucas
Copy link
Mannequin Author

sagetrac-dlucas mannequin commented Jan 5, 2016

comment:7

Thanks for the advice!

I changed my code accordingly.

David

@videlec
Copy link
Contributor

videlec commented Jan 5, 2016

Reviewer: Vincent Delecroix

@vbraun
Copy link
Member

vbraun commented Jan 6, 2016

Changed branch from u/dlucas/default_not_equals_for_linear_codes to f55e892

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants