Closed mjungmath closed 3 years ago
Description changed:
---
+++
@@ -1 +1 @@
-
+Immutability of chart functions, see #30261.
Author: Michael Jung
New commits:
286d3c6 | FreeModuleTensor, Vector: Subclass a new class ModuleElementWithMutability |
9df3d22 | sage.tensor.modules: Make all zero() and one() elements immutable |
4373ea2 | FreeModuleTensor: Replace special casing of the immutable zero by is_immutable |
a2ee8be | ModuleElementWithMutability.is_immutable, is_mutable: Change def to cpdef |
8600c2d | Merge branch 't/30181/immutable_elements_of_freemoduletensor' into t/30310/immutability_of_chart_functions |
76229bd | Trac #30310: immutability of chart functions |
Changed keywords from none to immutability
Dependencies: #30181
Why is #30181 a dependency of this ticket? A priori chart functions are totally independent from tensor fields. They even exist on pure topological manifolds.
It is because of
-from sage.structure.element import AlgebraElement
+from sage.structure.element import AlgebraElement, ModuleElementWithMutability
...
-class ChartFunction(AlgebraElement):
+class ChartFunction(AlgebraElement, ModuleElementWithMutability):
ModuleElementWithMutability
is first introduced in #30181.
I feel like the MultiCoordFunction
should inherit from Mutability
rather than copy the same code.
It'd be the same issue like we had for affine connections (#30280): __reduce__
(#30281).
I know, but as a stop-gap, you could instead implement a __reduce__
. I don't really like this duplication. Hopefully this week I can get around to properly doing #30281...
Replying to @mjungmath:
It is because of
-from sage.structure.element import AlgebraElement +from sage.structure.element import AlgebraElement, ModuleElementWithMutability ... -class ChartFunction(AlgebraElement): +class ChartFunction(AlgebraElement, ModuleElementWithMutability):
Ah yes, thanks.
I tried to remove the redundant code and inherit from Mutability
after #30281. For some reason, I still get a pickling error during doctest.
Furthermore, the code seems broken: is_immutable
does not return anything:
def is_immutable(self):
"""
...
"""
self._is_immutable
When did that happen?
I opened a ticket for the missing return
: #31181.
Furthermore, I've opened a ticket for the still remaining pickling test error: #31182.
Branch pushed to git repo; I updated commit sha1. New commits:
09086cf | Trac #30310: inherit from Mutability |
Changed dependencies from #30181 to #31181, #31182
Branch pushed to git repo; I updated commit sha1. New commits:
6c76b66 | Trac #30310: AssertionError -> ValueError |
Branch pushed to git repo; I updated commit sha1. New commits:
7247620 | Merge branch 'develop' into t/30310/immutability_of_chart_functions |
5ecbf3a | Trac #31181: return added |
8b20fc4 | Merge branch 't/31181/mutability_class_does_not_return_is_immutable' into t/30310/immutability_of_chart_functions |
4c33935 | Trac #31196: minor code improvements, py3 compatibility, documentation improved |
e5228d3 | Trac #31196: cpdef require methods + example added |
d957f73 | Trac #31196: unnecessary line in docstring removed |
d6d6ba4 | Trac #31182: `__getstate__` and __setstate__ |
6cbd1fd | Trac #31182: doctests added for `__setstate__` and __getstate__ |
848e96b | Merge branch 't/31182/mutability_class_and_pickling' into t/30310/immutability_of_chart_functions |
Green patchbot.
I think you are better off explicitly calling
ModuleElementWithMutability.__init__(self, parent)
Yes thanks, this should be better.
Pushed.
Branch pushed to git repo; I updated commit sha1. New commits:
e855ebc | Trac #30310: init ModuleElementWithMutability directly |
Reviewer: Travis Scrimshaw
Green bot => positive review.
Thank you.
Changed branch from u/gh-mjungmath/immutability_of_chart_functions to e855ebc
Immutability of chart functions, see #30261.
Depends on #31181 Depends on #31182
CC: @egourgoulhon @tscrim @mkoeppe
Component: manifolds
Keywords: immutability
Author: Michael Jung
Branch/Commit:
e855ebc
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/30310