Combining python and perl

Peng Yu pengyu.ut at gmail.com
Sun Aug 23 15:54:15 EDT 2009


On Aug 23, 8:00 am, Albert Hopkins <mar... at letterboxes.org> wrote:
> On Sun, 2009-08-23 at 05:37 -0700, Peng Yu wrote:
> > Hi,
>
> > According tohttp://www.python.org/doc/essays/comparisons.html, it
> > says
>
> > "Python and Perl come from a similar background (Unix scripting, which
> > both have long outgrown), and sport many similar features, but have a
> > different philosophy. Perl emphasizes support for common application-
> > oriented tasks, e.g. by having built-in regular expressions, file
> > scanning and report generating features. Python emphasizes support for
> > common programming methodologies such as data structure design and
> > object-oriented programming, and encourages programmers to write
> > readable (and thus maintainable) code by providing an elegant but not
> > overly cryptic notation. As a consequence, Python comes close to Perl
> > but rarely beats it in its original application domain; however Python
> > has an applicability well beyond Perl's niche."
>
> > My question is that how to combine both python and perl to take
> > advantages of both their strong aspects. Of course, I want to
> > primarily use python---that is why I send this message to this group.
>
> I'm not sure why you'd want to "combine" them.  You can pretty much do
> the same things with both language, it's just that one may emphasize one
> thing or make it easier for the user than the other.  For example,
> regular expressions in Perl.  It's built into the language, but that
> doesn't mean Python doesn't have regular expressions, just that Python
> is less "centered" around them.  If you want to use regular expressions
> with Python just "import re".

I understand that the sames things can be done with both language.

But I do think that certain applications can be done faster (in term
of the coding & debugging time, I don't care runtime here) with one
language than with another. Therefore, for any give problem, it is
meaningful to decide, based on the time to write and debug the code,
which part should be programmed with perl and which part should be
programed with python. However, when I split the code in perl and
python, the problem of the integration is introduced, which incur
additional coding and maintenance cost.

I am sure that somebody must has already encounter the similar
situation like I described above. I am wondering whether there are any
advices on how to take advantages of both languages to speed up the
code development time and reduce maintenance cost.

Regards,
Peng



More information about the Python-list mailing list