How big can a Python program be?

Peter Hansen peter at
Tue Aug 17 15:45:52 CEST 2004

Ben Last wrote:
> Unless I've misremembered, the Python interpreter executes lines as they're
> entered, whether read from a file or typed in (with the exception that
> blocks of code made up of multiple lines are executed when the last line is
> complete), so in theory, one could feed code to Python indefinitely and it'd
> just keep going.  

You've misremembered.  Python actually *compiles* the code prior
to executing it, turning it into bytecode.  That means there is
definitely a limit on how much code can be handled, based if nothing
else on the memory in your PC.


More information about the Python-list mailing list