On Fri, 07 Apr 2006 21:18:12 -0400, John Zenger wrote: > Your list probably contains several references to the same object, > instead of several different objects. This happens often when you use a > technique like: > > list = [ object ] * 100 > > ..because although this does make copies when "object" is an integer, it > just makes references in other cases.
Wrong. It always makes references. >>> L = [1]*3 >>> id(L[0]), id(L[1]), id(L[2]) (155972920, 155972920, 155972920) This isn't a caching issue either, it also happens for objects which aren't cached: >>> x = 4591034.56472 >>> y = 4591034.56472 >>> x == y True >>> x is y False >>> L = [x]*3 >>> x is L[0] is L[1] is L[2] True >>> y is L[0] False -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
