I have two python programs which are "supposedly" equivalent. I flatten a tree into a list while tracking levels for each node and then construct the tree as an html file. There is a one-line difference in the code, but python says the lines produce the same object.
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) [GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> l = [[]]*3 >>> k = [[] for i in range(3)] >>> l==k True >>> Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:38:48) [PyPy 1.9.0 with GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``the new pypy sport is to pass pypy bugs as cpython bugs'' >>>> l = [[]]*3 >>>> k = [[] for i in range(3)] >>>> l==k True >>>> The tree produced when using the list comprehension is normal, while the tree produced with the multiplication nests deeper and deeper without ever returning to the second level. That code is called inside a user class modeled after the treeitem demonstration class TreeDemo(SimplePanel). If someone will tell me where, I will send the code. Tis a bit long for here, but it is a real-world app.on which I am currently working. Michael --
