Hi all, have been hacking around a bit and finally got to this:
the class GapElement doesn't have a _sage_ method, when sage() is called, it defers to the ExpectElement method, which is not aware of the fact that we have a GAP object to start with. OTOH, I observed there is a _matrix_ method that creates sage matrices when the ring is provided and decided to build up from there. So, I included a _sage_ method in the GapElement class in gap.py, going like this: def _sage_(self): """ Override of ExpectElement._sage_ method. Aiming for a better conversion. Initially just for matrices! """ if self.IsMatrix(): ring = self[1,1].Ring().sage() return self._matrix_(ring) else: # If we don't know how to deal with this, return to the default. return ExpectElement._sage_(self) after applying the patch one can do as follows: sage: h = matrix(GF(5),2,[1,2, -1, 1]) sage: hh = gap(h) sage: hh.sage() [1 2] [4 1] sage: hh.sage() == h True So, it wasn't that hard (for matrices) after all. I don't know whether/ how this can be applied to the E(9) thing unless there is an IsSomething gap method that can be used for them. I'll prepare some doctests and upload a first patch. Cheers J
-- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org