On Thu, 13 Apr 2000, Jeremy Hylton wrote: > Looks like the proposed changed to PyObject_Compare matches E for your > example. The printed representation doesn't match, but I'm not sure > that is as important. > > >>> tight = [1, None, "x"] > >>> tight[1] = tight > >>> tight > [1, [...], 'x'] > >>> loose = [1, [1, None, "x"], "x"] > >>> loose[1][1] = loose > >>> loose > [1, [1, [...], 'x'], 'x'] > >>> tight > [1, [...], 'x'] > >>> tight == loose > 1 Actually, i thought about this a little more and realized that the above *is* exactly the correct behaviour. In E, [] makes an immutable list. To make it mutable you then have to "flex" it. A mutable empty list is written "[] flex" (juxtaposition means a method call). In the above, the identities of the inner and outer lists of "loose" are different, and so should be printed separately. They are equal but not identical: >>> loose == loose[1] 1 >>> loose is loose[1] 0 >>> loose is loose[1][1] 1 >>> loose.append(4) >>> loose [1, [1, [...], 'x'], 'x', 4] -- ?!ng "In the sciences, we are now uniquely privileged to sit side by side with the giants on whose shoulders we stand." -- Gerald Holton
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4