Why don't you just rewrite it in X?
Do you really want to convert the lines one-to-one? This seems pretty wasteful. Surely a better way is to just do step 3, drawing inspiration (and copying where appropriate) from the original code based on the <i>features</i> rather than the structure of the original code.<p>For example gtk-doc generates documentation from comments in c code. I&#x27;m guessing there is some perl code to parse c code, which i would substitute for the great &#x27;pycparser&#x27; library. With this method you would copy the existing code, fix it, then throw it away.<p>The methods to generate HTML from the comments is likely a lot of code. Sure, you could copy whatever method the current perl code does... Or you could substitute a lot of it for Jinja2.<p>Perhaps these examples are incorrect in the context of this specific project, but i don&#x27;t see the point in copying the lines one for one. Copy the <i>meaning</i> of the code into idiomatic python from the get go, and test the output against the known good perl code. I doubt perl code copied one for one is ever going to be idiomatic python code, so why bother, especially if it takes so long?<p>Edit: Yeah, tests are good. No tests are bad. Having a complete understanding of the code doesn&#x27;t require translating it line-for-line. Re-writing a project in a different language is a breaking change, but in the context of this project your initial tests could be (for every bit of C code you can possibly find that has gtk-doc comments):<p><pre><code>   &gt; gtk-doc.py &gt; a
   &gt; gtk-doc.pl &gt; b
   &gt; diff a b
</code></pre>
After you can find no differences, great, release it as an alpha or beta. People can then feed back any internal, weird quirky behavior they depend on. Rinse and repeat.<p>My point is spending 1000000000 hours hand-converting perl into python then again re-writing it into idiomatic python so you can catch any theoretical small perl-specific edge case in what is effectively a complete rewrite and a major version change is IMO a bit pointless, especially when converting Frankenstein python-perl into idiomatic Python may result in deleting large parts of the said slow-to-convert code.