Need help understanding list structure

moa47401 at gmail.com moa47401 at gmail.com
Mon May 2 17:30:48 EDT 2016


I've been using an old text parsing library and have been able to accomplish most of what I wanted to do. But I don't understand the list structure it uses well enough to build additional methods.

If I print the list, it has thousands of elements within its brackets separated by commas as I would expect. But the elements appear to be memory pointers not the actual text. Here's an example:
<gedcom.Element object at 0x018BDE10>

If I iterate over the list, I do get the actual text of each element and am able to use it.

Also, if I iterate over the list and place each element in a new list using append, then each element in the new list is the text I expect not memory pointers.

But... if I copy the old list to a new list using 

new = old[:] 
or 
new = list(old)

the new list is exactly like the original with memory pointers.

Can someone help me understand why or under what circumstances a list shows pointers instead of the text data?






More information about the Python-list mailing list