# Is there a command in SAGE which is equivalent to GAP's "ShallowCopy" ?

Dear SAGE forum,

I'd like to ask the following question:

Is there an equivalent in SAGE of GAP's "shallowcopy" ?

I'd like to associate to two times the same group two different character tables.

In GAP it is possible to do it as follows:

```
G:=AlternatingGroup(5);
H:=ShallowCopy(G);
ct_G:=CharacterTable(G);
```

and to then construct a different character table for H.

When I try to do this in SAGE, I always get the error message that G (!) already has a character table, although I wanted to assign a different (as far as the ordering of the rows and columns are concerned) character table to H (!)

EDIT (20.11.2019):

Here is part of my sage code:

```
HHHH=gap.Image(iso)
GGGG=gap.ShallowCopy(gap.Image(iso))
# Hier Einschub: CTBL wie in CTBLLib (falls vorhanden) wird nun gemacht:
gap.LoadPackage('"ctbllib"')
def CTBL_Breuer_fert(X):
StrDescr = gap.StructureDescription(X)
if gap.IsString(gap.StructureDescription(X)):
StrDescr = gap.StructureDescription(X)
CTBL_Breuer = gap.CharacterTable(StrDescr)
CTBL_Breuer_fertig = gap.CharacterTableWithStoredGroup(X,CTBL_Breuer)
else:
CTBL_Breuer_fertig = gap.CharacterTable(X)
return(CTBL_Breuer_fertig)
CTBL_Breuer_fertig = CTBL_Breuer_fert(HHHH)
# Hier Ende des Einschubs
ccl = [gap.ConjugacyClass(GGGG,x) for x in MAGMA_ccls_GG_for_GAP]
gap.SetConjugacyClasses(GGGG,ccl)
gap.SetUnderlyingGroup(tbl,GGGG)
gap.SetConjugacyClasses(tbl,ccl)
bij=[1..len(ccl)]
MyRecordFile = open("GAP_Record.txt",'w')
print >> MyRecordFile, "bij:=",
print >> MyRecordFile, bij,
print >> MyRecordFile, ";"
print >> MyRecordFile, "myrecfunct:=function()"
print >> MyRecordFile, "local RECOR;"
print >> MyRecordFile, "RECOR:=rec(bijection:=bij);"
print >> MyRecordFile, "return RECOR;"
print >> MyRecordFile, "end;"
MyRecordFile.close()
gap.Read('"GAP_Record.txt"')
recor=gap.myrecfunct()
gap.CompatibleConjugacyClasses(GGGG,ccl,tbl,recor)
CTBL=gap.CharacterTableWithStoredGroup(GGGG,tbl,recor)
```

After this last line (with CTBL=...) the error occurs. When I delete the lines between "# Hier Einschub..." and "# Hier Ende des Einschubs ", then the code works.

I would be grateful for any help.

Thanks in advance.

What exactly did you try

in Sage?Thank you very much for your comment. I edited the question.

By the way: The error message is as follows: RuntimeError: Gap produced error output Error, < G > has already a character table

I'm not sure you're really asking the right question with "Does Sage have an equivalent to ShallowCopy?" When you're working almost entirely with GAP objects, only functions in GAP would know how to do operations that dig into the details of GAP objects, such as

`ShallowCopy`

. The question is why are you having this problem in Sage. I don't know the immediate answer, but looking for a "Sage equivalent to ShallowCopy" is definitely going to lead you down the wrong path.Anyways I can't reproduce your problem because you didn't specify what

`iso`

is. In StackOverflow parlance, please provide a Minimal, Complete, Verifiable Example of the problem.