Perl Versus Python

Discussion in 'Perl Misc' started by surfunbear@yahoo.com, Feb 6, 2005.

  1. Guest

    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 ?
    , Feb 6, 2005
    #1
    1. Advertising

  2. 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
    A. Sinan Unur, Feb 6, 2005
    #2
    1. Advertising

  3. 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
    David Trudgett, Feb 6, 2005
    #3
  4. 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
    Sherm Pendley, Feb 6, 2005
    #4
  5. Anno Siegel Guest

    Sherm Pendley <> wrote in comp.lang.perl.misc:
    > 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
    Anno Siegel, Feb 6, 2005
    #5
  6. 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
    Sherm Pendley, Feb 6, 2005
    #6
  7. Anno Siegel Guest

    Sherm Pendley <> 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
    Anno Siegel, Feb 6, 2005
    #7
  8. 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
    Sherm Pendley, Feb 7, 2005
    #8
  9. On Sun, 06 Feb 2005 19:45:40 -0500,
    Sherm Pendley <> 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
    A.M. Kuchling, Feb 21, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    6,911
    Scott M.
    Oct 11, 2003
  2. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,497
  3. Python versus Perl ?

    , Feb 6, 2005, in forum: Python
    Replies:
    31
    Views:
    1,078
  4. Christoffer Sawicki
    Replies:
    5
    Views:
    250
    Christoffer Sawicki
    Sep 2, 2006
  5. Paul Butcher
    Replies:
    12
    Views:
    708
    Gary Wright
    Nov 28, 2007
Loading...

Share This Page