<p>Implementations are currently required to *have* an AST (or else declare non compliance with that particular flag to compile). They're definitely not required to have the *same* AST, thus all AST manipulation, like bytecode manipulation, is necessarily implementation dependent.</p>
<p>We don't even guarantee AST compatibility between versions of CPython.</p>
<p>I believe the appropriate warnings are already present in the ast module docs, but there may be misleading wording elsewhere that needs to be cleaned up. </p>
<p>Regards,<br>
Nick.</p>
<p>--<br>
Sent from my phone, thus the relative brevity :) </p>
<div class="gmail_quote">On Aug 14, 2012 5:03 AM, "Terry Reedy" <<a href="mailto:tjreedy@udel.edu">tjreedy@udel.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 8/13/2012 10:45 AM, Guido van Rossum wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Not so fast. If you make this a language feature you force all Python<br>
implementations to support an identical AST API. That's a big step.<br>
</blockquote>
<br>
I have been wondering about this. One could think from the manuals that we are there already. From the beginning of the ast chapter:<br>
<br>
"The ast module helps Python applications to process trees of *the* Python abstract syntax grammar. ... An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function" (emphasis on *the* added).<br>
<br>
and the entry for compile(): "Compile the source into a code or AST object."<br>
<br>
I see nothing about ast possibly being CPython only. Should there be?<br>
<br>
-- <br>
Terry Jan Reedy<br>
<br>
______________________________<u></u>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/<u></u>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com" target="_blank">http://mail.python.org/<u></u>mailman/options/python-dev/<u></u>ncoghlan%40gmail.com</a><br>
</blockquote></div>