Parsing files in python

Chris Angelico rosuav at gmail.com
Mon Dec 24 05:05:48 CET 2012


On Mon, Dec 24, 2012 at 12:46 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> snapOffset("Closet-S1_r1", "Closet-S2_r3", <0,0,0>)
>
>
> Already legal Python
>

Not quite. This is the one part that *doesn't* work directly. In
POV-Ray, a vector eg <x, y, z> is used to represent points,
transformations, and sometimes colors. The closest Python equivalent
is the tuple, but that requires that the brackets be changed:

snapOffset("Closet-S1_r1", "Closet-S2_r3", (0,0,0))

It would also require some smart footwork at the export end,
recognizing that a tuple needs to be output with angle brackets.

But other than that, yes, Python's a good choice for this. (I find it
amusing how I said "yeah, good idea to make a DSL, I wonder if you can
capitalize on Python" and you said "don't make a DSL, maybe you can
capitalize on Python" - opposite opening argument, same conclusion and
recommendation.)

ChrisA



More information about the Python-list mailing list