From: Anton S. <br...@po...> - 2001-04-23 15:46:14
|
Susanne Moelbert wrote: > I was very amazed yesterday when I wanted to calculate > a simple thing with Python. I typed > > for a in range(200): > for b in range(200): > for c in range(200): > pass > > and it took over 10 seconds! . . . range() works by creating a list [0, 1, ... 199]. The above code appears to do that 40201 times. This saves about half the time: spam = range(200) for a in spam: for b in spam: for c in spam: pass -- Anton Sherwood -- br...@p0... -- http://ogre.nu/ |