#20201: Improving Efficiency of LinearCode.NearestNeighborDecoder method
-------------------------------------+-------------------------------------
Reporter: arpitdm | Owner:
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-7.2
Component: coding theory | Resolution:
Keywords: beginner | Merged in:
Authors: Arpit Merchant | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/arpitdm/improving_efficiency_of_linearcode_nearestneighbordecoder_method|
170b3fc8ff8e9f7333a06e0c84f552857e911732
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by dlucas):
* status: needs_review => needs_work
* milestone: sage-7.1 => sage-7.2
Comment:
Hello,
You made a mistake when declaring the iterator: `It =
iter(self.code.list())` won't work (and does not) as `code` is a method
over `self`. So it should be: `It = iter(self.code().list())`.
You should always run the doctests after changing something, as they help
you to catch errors of this kind.
Use these commands:
{{{
sage -b #this rebuilds sage, necessary to include modifications made
sage -t <path to file> #here it will be sage -t linear_code.py
}}}
This does not cause any trouble here, but I like being specific with
exceptions, so I'd rather say
{{{
try:
#blah
except StopIteration:
pass
}}}
This way, you only `pass` when a `StopIteration` occurs, and any other
exception still returns the appropriate error message. Well, I don't see
how any other exception could occur here, but the most accurate the
better, doesn't it?
Best,
David
--
Ticket URL: <http://trac.sagemath.org/ticket/20201#comment:9>
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.