Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111728 > unrolled thread

Re: Max size of Python source code and compiled equivalent

Started byPeter Otten <__peter__@web.de>
First post2016-07-21 20:17 +0200
Last post2016-07-21 20:17 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Max size of Python source code and compiled equivalent Peter Otten <__peter__@web.de> - 2016-07-21 20:17 +0200

#111728 — Re: Max size of Python source code and compiled equivalent

FromPeter Otten <__peter__@web.de>
Date2016-07-21 20:17 +0200
SubjectRe: Max size of Python source code and compiled equivalent
Message-ID<mailman.37.1469125203.22221.python-list@python.org>
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 "<stdin>", line 1, in <module>
  File "<string>", line 101
    print('hi')
              ^
IndentationError: too many levels of indentation

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web