Hi,
Consider the following code (the field is arbitrary in this case)
sage: code = codes.HammingCode(2, GF(4,'a'))
The codewords (vectors) cannot be changed (note the absence of an error):
sage: code[0]
(0, 0, 0, 0, 0)
sage: code[0][0] = 1
sage: code[0]
(0, 0, 0, 0, 0)
yet they are not immutable, even when trying to set them so:
sage: code[0].is_immutable()
False
sage: code[0].set_immutable()
sage: code[0].is_immutable()
False
Is there any particular reason why the codewords are not immutable if they cannot be changed anyway?
If they were, using them as dictionary keys would be less of a hassle:
sage: {code[0]: "element"}
TypeError: mutable vectors are unhashable
I guess the current options are
sage: v = code[0]
sage: v.set_immutable()
sage: {v: "element"}
or
sage: {tuple(code[0]): "element"}
neither of which is particularly elegant.
Is there a way to set the all of the codewords as immutable?
I'm using Sage version 6.1.1 on a Linux machine.
Gerli