#20899: `AbstractLinearCode` shouldn't throw sensible error messages on printing
-----------------------------------------------+---------------------------
Reporter: jsrn | Type: defect
Status: new | Priority: major
Milestone: sage-7.3 | Component: coding
| theory
Keywords: linear code, error messages | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-----------------------------------------------+---------------------------
The doc explicitly says that to create a new class of linear codes, you
must override `_repr_` and `_latex_`. However, if the user forgets, a
bizarre error seems to be thrown when trying to print an instance of the
new code class:
{{{
%cpaste
from sage.coding.linear_code import AbstractLinearCode
from sage.coding.encoder import Encoder
class MyCode(AbstractLinearCode):
_registered_encoders = {}
_registered_decoders = {}
def __init__(self):
super(MyCode, self).__init__(GF(5), 10, "Monkey", "Syndrome")
self._dimension = 2
class MonkeyEncoder(Encoder):
def __init__(self, C):
super(MonkeyEncoder, self).__init__(C)
@cached_method
def generator_matrix(self):
return matrix(GF(5), 2, 10, [ [1]*5 + [0]*5, [0]*5 + [1]*5 ])
MyCode._registered_encoders["Monkey"] = MonkeyEncoder
MyCode._registered_decoders["Syndrome"] =
codes.decoders.LinearCodeSyndromeDecoder
--
sage: C = MyCode()
sage: C
<BOOM with bizarre error>
}}}
If `AbstractLinearCode` had a `_repr_` and a `_latex_` method which both
threw sensible error messages, this would be much more helpful to the
user.
--
Ticket URL: <https://trac.sagemath.org/ticket/20899>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.