<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 3, 2015 at 3:33 PM, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu" target="_blank">tjreedy@udel.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As I remember, the proposal is or would have to be to give code objects a new attribute -- co_ast.  This would require an addition to marshal to compress and uncompress asts.  It would expand both on-disk .pyc files and even more, in-memory code objects.<span class=""><br>
<br>
On 7/2/2015 4:25 PM, Neil Girdhar wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Why would it require "a lot of extra memory"?<br>
</blockquote>
> A program text size is measured in megabytes,<br>
> and the AST is typically more compact than the code as text.<br>
<br></span>
Why do you think that?  Each text token becomes an node object that is a minimun 56 bytes (on my 64-bit Win7 3.5). For instance, a one-byte '+' (in all-ascii code) balloons to at least 56 bytes in the ast and compiled back down to 1 byte in the byte code.  I expect the uncompressed in-memory size of asts to be several times the current size of corresponding code objects.</blockquote><div><br></div><div>Yes, but in fairness whitespace disappears, and there are some optimizations to the AST that could be made so that nodes with a single child for example are elided.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Terry Jan Reedy</font></span><span class="im HOEnZb"><br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br></span><div class="HOEnZb"><div class="h5">
-- <br>
<br>
--- You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/F4KEYEd6Cs0/unsubscribe" rel="noreferrer" target="_blank">https://groups.google.com/d/topic/python-ideas/F4KEYEd6Cs0/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas%2Bunsubscribe@googlegroups.com" target="_blank">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</div></div></blockquote></div><br></div></div>