[Tutor] function for memory usage

2008-07-10 Thread Yuanxin Xi
Hi, Could anyone please tell me which funtion (or which module) could return the total memory used by current python program? Thanks, Fred ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] python 2D list

2008-05-23 Thread Yuanxin Xi
I'm a Python newbie and still exploring, just surprised to see this 2D list assignment while debugging. >>> a = [[0] *3] *4 >>> a [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> a[1][2] = 1 >>> a [[0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1]] why is that a[0][2] a[1][2] a[2][2] a[3][2] are all a