I don't have any benchmark/performance data available, so I'll pass on 
those questions, but I'll take a stab at the third (being reasonably 
fluent in both languages).

On Sep 6, 2005, at 12:03 PM, Dieter Vanderelst wrote:
> 3 - In my opinion Python is very well suited for text processing. Does
> Perl have any advantages over Python in the field of textprocessing
> (like a larger standard library maybe).

One of the substantial reasons I choose Perl over Python for text 
processing tasks (where the total program won't be significantly large) 
is that while yes,  Python has decent text processing libraries, Perl 
is a decent text processing language. Regular expressions, data 
splitting and extraction, Unix system calls, capturing output of 
programs, etc. are  all present in the language itself, and the core 
builtin functions, without needing libraries. They are also implemented 
in a manner that is fairly natural to shell programmers.

That said, Python is a much cleaner language. Easier to maintain code 
in Python is. I wrote a custom web page template mechanism in Perl that 
comprised about 5 files and 2-3k lines of code (including comments and 
blank lines - cat |wc -l). I'd be leery of doing anything much more 
substantial than that in Perl - it would rapidly get quite unwieldily. 
OTOH, Python helps organize code and keep it clean - you don't have to 
wade through all manner of punctuation and special cases to keep track 
of what's going on. And Python's OO seems much more natural than 
Perl's.

In general, I consider the two languages to have largely different 
application domains. Perl is excellent for text processing, Unix 
scripting, and parsing HTML (its HTML::Parser library is 
extraordinary). Python is more general-purpose (Perl can be, but it 
gets ugly fast). I'd use Python where someone would otherwise use Java, 
and use Perl where shell scripts don't quite cut it.

I find text processing in Python to be only slightly more natural than 
C++ or Java text processing.

Just my $0.02. Either one will do the job; which one is better depends 
on your tastes, background, specific problem.

- Michael

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to