OT: Ultimate Language Syntax Cleanness Comparison
Jeremy Fincher
tweedgeezer at hotmail.com
Mon Feb 10 22:48:34 EST 2003
holger krekel <pyth at devel.trillke.net> wrote in message news:<mailman.1044895117.5567.python-list at python.org>...
> That sharp distinction is still a claim. Pointing to some files
> doesn't prove your point but example code does.
Yes, it does. Those two files *prove* that the data structure Perl is
parsed into is different than the data structure Perl is executed
from. QED.
> In python i do
> >>> import compiler
> >>> p=compiler.parseFile('test.py')
> >>> p # Parse tree
> Module(None, Stmt([Printnl([Const('hello world')], None)]))
> >>> p.filename='test.py' # fixup
> >>> c=compiler.pycodegen.ModuleCodeGenerator(p).getCode()
> >>> c
> <code object <module> at 0x828a720, file "test.py", line 2>
> >>> exec c
> hello world
> >>>
I know what you'd do in Python. I'm a Python coder, not a Perl coder.
> Can you show me the equivalent of this in perl *in real code*?
> Even just the parsing step? Or is it to painful to actually do it?
perldoc B::Bytecode. It's rather impossible to remain unconvinced
after reading that. But in case you are, look specifically at the
bottom of the documentation, which shows how to compile a Perl script
to bytecode and/or to some form of Perl assembly (whatever that is).
Anyway, I *seriously* hope you accept that as proof. I don't like
writing Perl code or using Perl APIs that I'll never again need.
Jeremy
More information about the Python-list
mailing list