How big can a Python program be?

Peter Hansen peter at engcorp.com
Tue Aug 17 10:23:02 EDT 2004


Ben Last wrote:

> Hmmm... are all the resulting code objects kept forever, or are those that
> are no longer required subject to garbage collection?  

Roughly, nothing is kept forever.  I think even interned strings
are now freed when no longer referenced.

It certainly seems possible to structure a program such that you
could feed more data to it, have it treat that data as code,
compiling it, executing it, and discarding it when no longer
required.

I guess it becomes more of a philosophical question whether the
program is the little loader that you created to do this, or
the endless stream of data which gets treated as code.  We're
not used to seeing programs as indefinitely sized...  we'd
probably say something like the program is only that code which
is memory resident at any given time.

In any case, the difficulty with writing infinitely sized
programs is that your day to day productivity, relative
to the size of the task at hand, is always zero...

-Peter



More information about the Python-list mailing list