Hi all,
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 1* The constructor for the repetition code in repetition_code.py uses GF(2). In order to avoid Error 1 (below) I needed to add the following line to reptition_code.py: from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF *Error 1* sage: codes.BinaryRepetitionCode(3) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-43e4a5a8cb42> in <module>() ----> 1 codes.BinaryRepetitionCode(Integer(3)) /home/mark/git/sage/local/lib/python2.7/site-packages/sage/coding/repetition_code.pyc in __init__(self, length) 13 14 def __init__(self, length): ---> 15 super(BinaryRepetitionCode, self).__init__(GF(2), length, "RepetitionGeneratorMatrixEncoder", "MajorityVoteDecoder") 16 self._dimension = 1 17 NameError: global name 'GF' is not defined *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 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.