Copy of Struct

23 views
Skip to first unread message

Pilou

unread,
Feb 4, 2016, 9:08:29 AM2/4/16
to Construct
Hi everyone,

Just starting to play around with your package ... so far so ggod ! But I have tried to copy a Struct definition to avoid doing another one with the same content. The idea was to copy the struct definition then change the names with an index to differentiate the fields for later use within the embedded struct parsing process.

With __copy__() I end up with:
TypeError: __setstate__() takes exactly 2 arguments (3 given)

Any idea of my mistake ?

def instanciate_constr(struct_name, ind):
    obj = struct_name.__copy__()
    obj.name=struct_name.name+"_"+str(ind)
    for sc in obj.subcons:
      if (sc.name != None):
        sc.name = sc.name+"_"+str(ind)
    return obj
Reply all
Reply to author
Forward
0 new messages