U
Uwe Mayer
Hi,
I am using struct.unpack() quite often. unpack() returns a tuple, however a
tuple with always the same id(), which is AFAIK the memory location of the
structure.
I found myself working with above tuple, initialising other data structures,
etc... and when I tried to change one list element, suddenly all list
elements change => so they all contain the identical object
Now what are the rules when Python re-uses an old object (as with
struct.unpack() ) and when does it create new objects?
And what ist the proposed solution for dealing with this situation, i.e. how
to I create a true copy of what struct.unpack() returns me?
Thanks in advance
Ciao
Uwe
I am using struct.unpack() quite often. unpack() returns a tuple, however a
tuple with always the same id(), which is AFAIK the memory location of the
structure.
I found myself working with above tuple, initialising other data structures,
etc... and when I tried to change one list element, suddenly all list
elements change => so they all contain the identical object
Now what are the rules when Python re-uses an old object (as with
struct.unpack() ) and when does it create new objects?
And what ist the proposed solution for dealing with this situation, i.e. how
to I create a true copy of what struct.unpack() returns me?
Thanks in advance
Ciao
Uwe