Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl Versus Python

Reply
Thread Tools

Perl Versus Python

 
 
surfunbear@yahoo.com
Guest
Posts: n/a
 
      02-06-2005

I've read some posts on Perl versus Python and studied a bit of my
Python book.

I'm a software engineer, familiar with C++ objected oriented
development, but have been using Perl because it is great for pattern
matching, text processing, and automated testing. Our company is really
fixated on risk managnemt and the only way I can do enough testing
without working overtime (which some people have ended up doing) is by
automating my testing. That's what got me started on Perl.

I've read that many people prefer Python and that it is better than
Perl. However, I want to ask a few other questions.


1. Perl seems to have alot of packaged utilities available through
CPAN, the comprehensive perl network. These can aid in building
parsers, web development, perl DBI is heavily used. This seems to be a
very important benifit. I'm not sure that Python is as extenive at all
in that regard ? Perl also has excellent pattern matching compared to
sed, not sure about how Python measures up,
but this seems to make perl ideally suited to text processing.

2. Python is apparantly better at object oriented. Perl has some kind
of name spacing, I have used that in a limited way. Does Perl use a
cheap and less than optimal Object oriented approach ?
That was what someone at work said, he advocates Python.
Is it likely that Perl will improve it's object oriented features
in the next few years ?

3. Perl is installed on our system and alot of other systems.
You don't have to make sys admins go out of there way to make it
available. It's usualy allready there. I also did a search of job
postings on a popular website. 108 jobs where listed that require
knowledge of Perl, only 17 listed required Python. Becomeing more
familiar with Perl might then be usefull for ones resume ?



If Python is better than Perl, I'm curious how really significant
those advantages are ?

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      02-06-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote in news:1107695900.340876.270130
@g14g2000cwa.googlegroups.com:

> I'm a software engineer, familiar with C++ objected oriented
> development,


Good for you.

....

> I've read that many people prefer Python and that it is better than
> Perl. However, I want to ask a few other questions.


This is a FAQ. Please see:

perldoc -q "How does Perl compare"

Sinan
 
Reply With Quote
 
 
 
 
David Trudgett
Guest
Posts: n/a
 
      02-06-2005
(E-Mail Removed) wrote:

> I've read some posts on Perl versus Python and studied a bit of my
> Python book.
>


Hey, you didn't even cross post to the Python newsgroup! How's a
language war supposed to start like that??

David
 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      02-06-2005
(E-Mail Removed) wrote:

> 1. Perl seems to have alot of packaged utilities available through
> CPAN, the comprehensive perl network.


In my opinion, CPAN is Perl's major advantage. With CPAN, the question
becomes less about the code you write, and more about the code you *don't*
write.

> 2. Python is apparantly better at object oriented. Perl has some kind
> of name spacing, I have used that in a limited way. Does Perl use a
> cheap and less than optimal Object oriented approach ?


That's a matter of philosophy. Perl allows a clean OO approach - but it
doesn't require it. For my part, I do OO in Perl all the time, and I don't
have a problem with it.

I find it puzzling that some folks need a language that forcibly prevents
them from crossing object boundaries - why can't they simply refrain from
doing so on their own? If they can't, isn't that their own weakness, not
that of the language they're using?

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      02-06-2005
Sherm Pendley <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> (E-Mail Removed) wrote:


> That's a matter of philosophy. Perl allows a clean OO approach - but it
> doesn't require it. For my part, I do OO in Perl all the time, and I don't
> have a problem with it.


So do I -- as long as I deal with my own code.

> I find it puzzling that some folks need a language that forcibly prevents
> them from crossing object boundaries - why can't they simply refrain from
> doing so on their own?


They don't, that's the problem. In particular, some authors of classes
published on CPAN don't. Perl lets you drag stuff in and out of an object
willy-nilly, so that's what people do, making clean inheritance harder
than it has to be. I for one would be glad about a way to enforce the
definition of accessors and their use throughout the rest of a class.

> If they can't, isn't that their own weakness, not
> that of the language they're using?


Well, yes, but the weakness becomes a weakness of available software.
It wouldn't be an entirely bad thing if OO newbies had something in
Perl to stiffen their backs. In Perl, you must know how to do it the
OO way. In Python, I understand, there is no other.

Anno
 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      02-06-2005
Anno Siegel wrote:

> They don't, that's the problem. In particular, some authors of classes
> published on CPAN don't. Perl lets you drag stuff in and out of an object
> willy-nilly, so that's what people do, making clean inheritance harder
> than it has to be. I for one would be glad about a way to enforce the
> definition of accessors and their use throughout the rest of a class.


I prefer the approach taken by Cocoa/Objective-C. Objective-C does offer
both "private" and "protected" modifiers, but they're trivially simple to
bypass with a type cast.

Few people actually do so, because there are a number of tangible benefits
to be gained by writing and using accessors that follow a simple design
pattern. The pattern is pervasive through all of Cocoa, and using it in
your own code makes a number of things Just Work - key-value coding
observing, serialization, Cocoa bindings, etc.

In short, if Perl's approach has a weakness, I don't think it's the lack of
a stick, but rather the lack of a tasty carrot.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      02-06-2005
Sherm Pendley <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
>
> > They don't, that's the problem. In particular, some authors of classes
> > published on CPAN don't. Perl lets you drag stuff in and out of an object
> > willy-nilly, so that's what people do, making clean inheritance harder
> > than it has to be. I for one would be glad about a way to enforce the
> > definition of accessors and their use throughout the rest of a class.

>
> I prefer the approach taken by Cocoa/Objective-C. Objective-C does offer
> both "private" and "protected" modifiers, but they're trivially simple to
> bypass with a type cast.


Okay...

> Few people actually do so, because there are a number of tangible benefits
> to be gained by writing and using accessors that follow a simple design
> pattern. The pattern is pervasive through all of Cocoa, and using it in
> your own code makes a number of things Just Work - key-value coding
> observing, serialization, Cocoa bindings, etc.


Now, these benefits seem to be merits of Cocoa, not of Objective-C per
se. A good Perl class hierarchy written for some purpose could do that
for its clients too.

> In short, if Perl's approach has a weakness, I don't think it's the lack of
> a stick, but rather the lack of a tasty carrot.


To stick (hehe) with the image, the carrot is there, if predictable behavior
of derived classes is tasty. But it's way out of sight.

You don't see the immediately gain in painfully going through accessors
when (for instance) a hash slice is more natural (and more perlish).
If you don't know the rules of the OO game, you're bound to say: It's my
class (right), it's my code (also right), it's my method (wrong!). It's
also a method of any class that inherits from yours, and you must
*consider* that, it makes a difference in non-obvious ways. It seems
to me that Perl OO requires more of that kind of consideration than
other OO languages.

Sure, the freedom we gain in Perl is lovely. The way Exporter.pm uses
inheritance to its advantage without being otherwise OO at all is a
nice example.

Sorry for explaining in so much detail what must mostly be clear to you.

Anno
 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      02-07-2005
Anno Siegel wrote:

> also a method of any class that inherits from yours, and you must
> *consider* that, it makes a difference in non-obvious ways. It seems
> to me that Perl OO requires more of that kind of consideration than
> other OO languages.


I agree. I certainly wouldn't suggest Perl as a language for teaching OO
concepts. In fact I don't think I'd suggest Perl as any sort of teaching
language at all - it's far too forgiving to be useful for that.

I simply meant to counter the claim made by many Python advocates, that it's
utterly impossible to write good OO code in Perl, because it lacks access
modifiers. That's a straw-man argument with no basis in logic. Not only is
it possible write good OO code without them, it's also possible to declare
everything as "public" and write sloppy OO in languages that do have them.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
A.M. Kuchling
Guest
Posts: n/a
 
      02-21-2005
On Sun, 06 Feb 2005 19:45:40 -0500,
Sherm Pendley <(E-Mail Removed)> wrote:
> I simply meant to counter the claim made by many Python advocates, that it's
> utterly impossible to write good OO code in Perl, because it lacks access
> modifiers.


I doubt anyone is making that claim, but Python doesn't have access
modifiers either.

--amk
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Mozilla versus IE versus Opera versus Safari Peter Potamus the Purple Hippo Firefox 0 05-08-2008 12:56 PM
equal? versus eql? versus == versus === verus <=> Paul Butcher Ruby 12 11-28-2007 06:06 AM
Certification - MCP versus MCSA versus MCSE =?Utf-8?B?Q2FuYWRhX0d1eU0=?= Microsoft Certification 1 08-24-2006 06:33 PM
script versus code versus ? Russ ASP .Net 1 06-10-2004 03:06 AM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM



Advertisments