I recently worked through the coding theory thematic tutorial "structures in coding theory" which teaches users how to create custom code classes. The tutorial in question is available from:
https://doc.sagemath.org/html/en/thematic_tutorials/structures_in_coding_theory.html
I noticed two problems which I've come up with solutions for, but I would like to check that I haven't done something silly (as I am new to Sage). For the record, I am running Sage version 8.0.beta2, Release Date: 2017-04-12 on 64-bit Ubuntu Linux 16.04. They problems are small but since the tutorial is aimed at people who may be learning to dig around in the source code for the first time, I think they are worth looking at. Please let me know if I should open a ticket and fix the following problems.
Many thanks,
Mark.
Problem 2
As described in section VI of the tutorial, once the user has written their repetition_code.py file they need to add some lines to codes_catalog.py, encoders_catalog.py and decoders_catalog.py. If the user follows the tutorial exactly and adds, for example,
from repetition_code import BinaryRepetitionCode
to codes_catalog.py then they will generally encounter Error 2 (below). Note that if the user runs ../../../sage -br from sage/src/sage/coding then they will not encounter Error 2. In order to avoid Error 2 they could instead be instructed to add
from sage.coding.repetition_code import BinaryRepetitionCode
to codes_catalog.py (and similar for the other files in question).
Error 2
sage: codes.HammingCode(GF(2),3)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-2617e5c84fa6> in <module>()
----> 1 codes.HammingCode(GF(Integer(2)),Integer(3))
/home/mark/git/sage/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__getattr__ (/home/mark/git/sage/src/build/cythonized/sage/misc/lazy_import.c:3866)()
355 True
356 """
--> 357 return getattr(self._get_object(), attr)
358
359 # We need to wrap all the slot methods, as they are not forwarded
/home/mark/git/sage/src/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (/home/mark/git/sage/src/build/cythonized/sage/misc/lazy_import.c:2507)()
247 elif self._at_startup and not startup_guard:
248 print('Option ``at_startup=True`` for lazy import {0} not needed anymore'.format(self._name))
--> 249 self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name)
250 alias = self._as_name or self._name
251 if self._deprecation is not None:
/home/mark/git/sage/local/lib/python2.7/site-packages/sage/coding/codes_catalog.py in <module>()
34 from sage.coding.linear_code import LinearCode
35 #from sage.coding.repetition_code import BinaryRepetitionCode
---> 36 from repetition_code import BinaryRepetitionCode
37
38 _lazy_import('sage.coding.code_constructions',
ImportError: No module named repetition_code
They problems are small but since the tutorial is aimed at people who may be learning to dig around in the source code for the first time, I think they are worth looking at. Please let me know if I should open a ticket and fix the following problems.
I do agree with Simon and you, this should be fixed. You can of course open a ticket for this!
Cc me on your trac ticket (my ID is dlucas) and I will review your changes.