Perl to Python conversion

Intchanter / Daniel Fackrell unlearned at gmail.com
Wed Dec 9 16:10:34 EST 2009


On Dec 9, 1:33 pm, martin.sch... at gmail.com (Martin Schöön) wrote:
> First off: I am new here and this is my first post after
> lurking for quite some time.
>
> Second off: I don't know much Python---yet.
>
> Problem: I have come across a small open source application
> that I find quite useful. It does have one major flaw though.
> Its output is in imperial units. Converting isn't a big deal
> for occasional use but if I start to use this stuff on a
> regular basis...
>
> So I down-loaded the source code and found this thing is written
> in Perl.
>
> Should I learn enough Perl to add the conversion? Probably
> but this may be a nice excuse to get my Python education
> going and if I do I might as well re-do the user interface.
>
> If I do re-write this thing in Python I might need to learn both
> Perl and Python...
>
> Hence, are there any Perl to Python converters? So far I
> have only found bridgekeeper which really is (was?) consultancy.
> Apart from that I only find people recommending a manual re-write.
>
> Any thoughts/recommendations?
>
> TIA,
>
> /Martin

Martin,

A full answer will depend a lot on several different factors,
including the length of the Perl code, what style it was written in
(there seem to be uncountably many possibilities), your experience
with languages in general, and with that style in particular.

In general, though, if your primary purpose is to learn Python and
ending up with a useful tool is secondary, I'd recommend rewriting the
tool from scratch, possibly keeping the Perl source handy.  If the
existing tool is command-line based, you might also be able to write a
short script through which you can pipe the output of the original
program to handle the conversion.

Intchanter
Daniel Fackrell



More information about the Python-list mailing list