Dictionaries as records

Bill Wilkinson bwilk_97 at yahoo.com
Wed Dec 19 10:13:41 EST 2001


"John Roth"
> In this case, you have one copy of each of your input
> strings, not 15000 copies! The memory usage should be
> pretty close to pure dictionary overhead.

I don't see how that can be. If they were all copies of the same reference,
wouldn't a change in one record be reflected in all?  Below I make a change
to one record and the others remain the same:

>>>tbl[1]["g11"]  #original value
 'ldjfljdfkjdf'
>>> tbl[1]["g11"] = "f"  #change rec one to 'f'/
>>> tbl[1]["g11"]    #it's value is different now.
'f'
>>> tbl[2]["g11"]    #rec 2 remains the same.
'ldjfljdfkjdf'


Now the question. Am I misunderstanding what is happening above?

Thank you for your assistance

Bill





More information about the Python-list mailing list