Re: [Python-Dev] Localized Type Inference of Atomic Types in Python
Hi Brett, On Tue, May 24, 2005 at 04:11:34PM -0700, Brett C. wrote: My thesis, Localized Type Inference of Atomic Types in Python, was successfully defended today for my MS in Computer Science at the California Polytechnic State University, San Luis Obispo. Congratulations ! Nitpickingly... thanks for the references to Psyco, though I should add that Psyco has been supporting more than just ints and strings since shortly after my first e-mail to python-dev about it (in 2001 I think) :-) it actually knows more or less about all common built-in types. A bientot, Armin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] AST manipulation and source code generation
I wrote something like this (called pyunparse) a little while ago. It's not the cleanest code in the world, but it worked for my original use case (debugging Logix, which uses python ASTs as an IR): http://www.pycs.net/users/445/stories/7.html Cheers, /arg On May 24, 2005, at 9:56 AM, Jeremy Hylton wrote: On 5/24/05, Ka-Ping Yee [EMAIL PROTECTED] wrote: Would there be any interest in extending the compiler package with tools for AST transformations and for emitting Python source code from ASTs? Sure. Eventually, we'll have to figure out how to unify the compiler package AST and the ast-branch AST, but don't let that delay you now. I was experimenting with possible translations for exception chaining and wanted to run some automated tests, so i started playing around with the compiler package to do source-to-source transformations. Then i started working on a way to do template-based substitution of ASTs and a way to spit source code back out, and i'm wondering if that might be good for experimenting with future Python features. (If there's already stuff out there for doing this, let me know -- i don't intend to duplicate existing work.) I don't know of any existing work, but it certainly sounds useful. Jeremy ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/andy% 40andygross.org ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] AST manipulation and source code generation
Ka-Ping, FWIW, I've also got an implementation, which is based on the parser module rather than the compiler module. Much simpler, imo, but whitespace isn't preserved (could be perhaps?). Anyway, take it or leave it. Links follow. chad - Subversion repository: http://svn.zetadev.com/repos/public/ASTutils/ The relevant method is 'ast2text' in ASTutils.py: http://svn.zetadev.com/repos/public/ASTutils/tags/0.2.0/ASTutils.py API documentation for this method: http://www.zetadev.com/software/ASTutils/latest/api/public/ASTutils.ASTutils-class.html#ast2text API documentation root: http://www.zetadev.com/software/ASTutils/latest/api/ ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Localized Type Inference of Atomic Types in Python
Armin Rigo wrote: Hi Brett, On Tue, May 24, 2005 at 04:11:34PM -0700, Brett C. wrote: My thesis, Localized Type Inference of Atomic Types in Python, was successfully defended today for my MS in Computer Science at the California Polytechnic State University, San Luis Obispo. Congratulations ! Nitpickingly... thanks for the references to Psyco, though I should add that Psyco has been supporting more than just ints and strings since shortly after my first e-mail to python-dev about it (in 2001 I think) :-) it actually knows more or less about all common built-in types. Crap, sorry! That is what I get for taking someone's word instead of digging into it myself. -Brett ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com