Python hits the spot

Peter Hansen peter at
Sun Jun 23 19:09:10 EDT 2002

Peter Hansen wrote:
> Pär Kurlberg wrote:
> >
> > > It's no wonder that 1000 lines of uncommented code behave like that, taking
> > > into account that you were trying to integrate several (Tcl/Tk, Fortran, C,
> > > Python) systems in a hurry, and, I presume, not knowing most of them.
> >
> > Funny you should mention this.  On my laptop (IBM Thinkpad with 128
> > megs of ram) the following two-liner gets me a lockup (i.e. keyboard
> > and mouse completely unresponsive, powertoggle needed):
> >
> > for i in range(50*1000*1000):
> >    pass
> >
> > (I am serious.)  Happened some time ago, but I never got around to
> > filing a bug report (this thread was a good reminder.)
> Given that you're asking it to allocate something like 800MB of
> memory, and not all at once but in a list that grows steadily
> in size and has to be copied over and over, I'm not at all
> surprised it appears to lock up a machine with only 128MB.

Judging by Tim's reply elsewhere, and giving this a moment more
thought, I can see the comment about 'grows steadily' is false.
Of course it knows how many elements need to be allocated ahead
of time so it doesn't actually need to grow the list.

Doesn't change anything else though...


More information about the Python-list mailing list