#14793: Unique representation for homsets
-------------------------------+--------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.12
Component: categories | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
-------------------------------+--------------------------------------------
Comment (by SimonKing):
Perhaps the following idea works and is clean.
What does Python currently do when unpickling a modular symbol? Well, it
creates a new instance of the underlying class, and fills its `__dict__`.
I guess it is possible to compute the base ring from the contents of the
`__dict__` (need to find out how, but I am sure it is encoded there
somewhere. Indeed, we have
{{{
sage: M = ModularSymbols(6)
sage: M._ModularSymbolsSpace__character.base_ring()
Rational Field
sage: M.base()
Rational Field
}}}
And that means, we could create an unpickling function doing the
following, where dct is the `__dict__` and cls is the class of the modular
symbol to be unpickled:
{{{
#!python
M = cls.__new__(cls)
ParentWithAdditiveAbelianGens.__init__(M,base=dct['_ModularSymbolsSpace__character'].base_ring(),
category=Modules(dct['_ModularSymbolsSpace__character'].base_ring()))
M.__dict__ = copy(dct)
return M
}}}
Well, I will try it later...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14793#comment:16>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.