Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: Max size of Python source code and compiled equivalent Date: Thu, 21 Jul 2016 20:17:49 +0200 Organization: None Lines: 33 Message-ID: References: <1469119864.416096.672987297.69184C7E@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de JWyoiML+bUFZLCdF1BPk5w5lw4RAkFbR+bxQH7eFKYXw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'subject:code': 0.07; '"if': 0.09; '101': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'def': 0.13; 'malcolm': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.16; '>>>': 0.20; '"",': 0.22; 'parser': 0.22; 'code.': 0.23; '(most': 0.24; "i've": 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'rest': 0.26; 'about.': 0.29; 'boundaries': 0.29; 'indentation': 0.29; 'information?': 0.29; "we're": 0.30; 'code': 0.30; 'compiled': 0.32; 'source': 0.33; 'traceback': 0.33; 'file': 0.34; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'success.': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'wanted': 0.37; 'to:addr:python.org': 0.40; 'where': 0.40; 'received:de': 0.40; 'our': 0.64; 'levels': 0.70; 'covers': 0.72; 'background:': 0.81; '3.5.1': 0.84; 'dsl': 0.84; 'subject:source': 0.84; 'limits:': 0.91; 're-assure': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd91e0.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <1469119864.416096.672987297.69184C7E@webmail.messagingengine.com> Xref: csiph.com comp.lang.python:111728 Malcolm Greene wrote: > We're writing a DSL parser that generates Python code. While the size of > our generated code will be small (< 32K), I wanted to re-assure the rest > of our team that there are no reasonable code size boundaries that we > need to be concerned about. I've searched for Python documentation that > covers max Python source (*.py) and compiled file (*.pyc) sizes without > success. Any tips on where to look for this information? > > Background: Python 3.5.1 on Linux. I don't know if/where this is documented, but there are structural limits: >>> def nested(N): ... return "".join(" " * i + "if 1:\n" for i in range(N)) + " " * N + "print('hi')" ... >>> print(nested(3)) if 1: if 1: if 1: print('hi') >>> exec(nested(99)) hi >>> exec(nested(100)) Traceback (most recent call last): File "", line 1, in File "", line 101 print('hi') ^ IndentationError: too many levels of indentation