Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Perl VS Python

by supernewbie (Beadle)
on Aug 04, 2001 at 17:18 UTC ( #102231=perlquestion: print w/ replies, xml ) Need Help??
supernewbie has asked for the wisdom of the Perl Monks concerning the following question:

Master Monks:

Could you please tell me WHY and HOW Perl is better than Python?

My co-worker keeps telling me how Python is 'powerful' every single day... He says Python is much better than Perl, because it has simpler syntax and design, etc....

Is Python really going to replace Perl as the king of scripting languages? Will Perl 6 strike back at Python?

Well, I have ask a few monks and bishops about this already. But I really would like to hear other Perl Masters' thoughts and advices on this issue as well.

Edit kudra, 2001-08-06 Replaced CODE tag with em to give similar visual effect without long lines

Comment on Perl VS Python
Re: Perl VS Python
by Beatnik (Parson) on Aug 04, 2001 at 17:44 UTC
    Classic example of Perl Advocacy...

    IMHO you can't judge if one language is suckier than the other if you donno both languages equally well. (Except for COBOL, coz I KNOW it sucks, that's just a fact).
    If you're gonna discuss this in detail with him, grab a good Perl book and try to counter all so called bad things he states about Perl. Also get a good Python book and learn it too. Have a language war (and get pictures) :))

    Ofcourse if all other programming languages were considered illegal, you could just have him arrested for even mentioning that stuff... *wink* *wink*

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
Re: Perl VS Python
by z0d (Hermit) on Aug 04, 2001 at 18:28 UTC
    I think it no good, to compare Perl and Python. Both have different goals. I think Perl is "more multipurpose". But Python has great object oriented part and I think Python is easier to learn. It's a bit like BASIC (away from the OO part).

    <-- z0d -->
      But Python has great object oriented part

      ORLY? Larry Wall:

      Python

      After Tcl came Python, which in Guido's mind was inspired positively by ABC, but in the Python community's mind was inspired negatively by Perl. I'm not terribly qualified to talk about Python however. I don't really know much about Python. I only stole its object system for Perl 5. I have since repented.

      :-)

Re: Perl VS Python
by tachyon (Chancellor) on Aug 04, 2001 at 18:33 UTC

    All languages have their points of strength and weakness except for Perl which is more of a religion than a programming language and has not faults whatsoever :-)

    Now that you have my biases firmly stated here are some opinions

    Some Perl strengths:

    1 Mature language with most of the major bugs ironed out, Python is not. Also Perl has excellent cross platform compatibility - porting is usually a breeze. Oops where is some wood to knock on?

    2 CPAN provides a huge *free* repository of quality, tested code to perform almost any task you can think of. There is nothing comparitive for Python.

    3 The Perl culture means that a newly annointed saint such as myself will offer their time for free and gratis to someone called supernewbie ;-) The peer support within the Perl community is second to none - this will be a hard act to follow.

    4 Perl can be an imperitive, procedural, functional or object oriented language depending on what you want. As a result you can do almost anything in it and better still as your skills grow Perl will continue to deliver.

    Perl's major disadvantages are:

    1 It is not a trendy newkid on the block.

    2 TIMTOWDI and the syntax mean you can write very obfuscated Perl, without even trying - see my sig for instance. It is also very easy to get a script working (Perl or Python) which means that there is a lot of bad code out there - see Matt's Script Archive for some popular all time classics. There will be plenty of crappy Python code in time ;-)

    3 As a scripting language it is relatively slow for some tasks but with 1GHz processors (now) and 2GHz soon this is less of an issue every day. Komodo (A Perl IDE) from Active State is written in Python, so you can do major apps in scripting code although this is not without problem see Perl Builder 2.0 where we get onto Komodo which is dog slow on anything but a top range machine.

    Always remember that being on the bleeding edge is fine, provided if you are into that kind of thing. You might like to look at Perl Advocacy and Perl as Cr*p? for more discussion on this subject.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      *celebrating a 400th node'versary...*

      2 TIMTOWDI and the syntax mean you can write very obfuscated Perl, without even trying...

      I disagree... I have been trying very hard writing VERY obfuscated code for months now. Some people just seem to think in obfuscations (ppl like T-Shirt guy one and T-Shirt guy two). I'm pretty confident that it's harder to write hard code than it is to write easy code.

      3 As a scripting language it is relatively slow for some tasks but with 1GHz processors (now) and 2GHz soon this is less of an issue every day.

      Compared too uhm for instance Java, Cobol, BASIC, etc (which clearly aren't scripting languages)?? IMHO it's a platform/hardware issue at most. On the Perl Builder/Komodo thingie... beat me til I'm blue but I like a plain, no nonsense editor on a plain, console based OS.

      I'm going for quantity nodes, not for quality nodes - myself talking to kudra at the Perlmonks BoF (not realizing I'd reach 400 within days).

      Greetz
      Beatnik
      ... Quidquid perl dictum sit, altum viditur.
Re: Perl VS Python
by dga (Hermit) on Aug 04, 2001 at 20:35 UTC

    You can write a one-liner to do a really complex pattern extract from a file in Perl without using (or writing) a single class.

    There is a Perl monastery.

    You don't have to write OO if you don't want to. (mentioned another way above)

    Given how easy it is to do easy and medium stuff in Perl and the number of people who use it daily, it will not be replaced by Python or anything else anytime soon.

    Long live Perl!

Re: Perl VS Python
by gary kuipers (Beadle) on Aug 04, 2001 at 20:56 UTC
    I'm no Python expert, but what I have done in Python convinces me that Python is a love child born of an unholy union of Perl and ASP. : - )
    Stick with Perl! Python does what Perl does but has an "ASPish" look to it.
Re: Perl VS Python
by aquacade (Scribe) on Aug 04, 2001 at 22:32 UTC
    I think it's an undisputed fact that CPAN is Perl's killer app and Zope is Python's.

    See this link for Perl vs Python writeup: http://www.opticality.com/Press/ZopeCorp/UdellPerlPython

    other Zope propaganda at: http://www.opticality.com/Press/ZopeCorp

    Zope itself at: http://www.zope.org/

    Judge for yourself! I'll be using Perl for a very long time, not Python! I looked at Python and cringed!

    Also see japhy humor at: 100358

    ..:::::: aquacade ::::::..

      what did you say?? CPAN is an APP? hahahahahahaaaaaaaaaa!!!!! you fanbois should read up before you speak!
      Zope? Are you serious? I don't think any serious Python coders use that thing anymore.
        Says perinn in 2009, in response to a 2001 post, 2001 when Zope was still dope, when Python founder Guido van Rossum still worked for Zope Corp
Re: Perl VS Python
by abstracts (Hermit) on Aug 04, 2001 at 23:46 UTC
    Hello,

    Your co-worker keeps telling you how Python is `powerful', why not tell him how Perl is powerful too? Each language has its strengths and weaknesses. If he claims that Perl has no strengths or Python has no weaknesses, stop the debate because it will get you nowhere.

    If Python is better than Perl because it has simpler syntax, then LISP is better than all languages ever because the LISP syntax is the simplest. What sets Perl apart from all languages is its context dependency. An expression means different things depending on where you put it. This may be overwhelming for beginners. As you advance through the language, the language advances with you. Simple constructs are available for beginners.

    Perl allows you, among other things, to write concise programs that are exactly to the point. Shorter code that is still readable aids greatly in development and debugging cycles. Perl programs can literally speak and say what they are doing. You don't need to spell things that can be inferred from the context.

    As others have already mentioned, CPAN is probably Perl's selling point. With tons of modules written to do almost anything, writing some very involved programs is as simple as calling a function defined in one of the modules.

    As for whether Python is replacing Perl or vice versa, I don't think either will replace the other. Python and Perl have very different design goals. Python programmers are different from Perl programmers. They think differently, and that's why they chose different languages.

    If you really want to know what will happen if Perl and Python get merged, look at the Parrot language.

    Aziz,,,

Re: Perl VS Python
by thpfft (Chaplain) on Aug 05, 2001 at 01:00 UTC

    There are four ways in which one language might be better than another, off the top of my head. any remarks about python which follow are not very well-informed, by the way.

    1. it suits your tasks
    If you're munging masses of data, dealing with texts, creating conversational interfaces, doing things quickly, designing as you build (oops), or no doubt many other things I haven't encountered, perl is what you need. I'm afraid someone else will have to write the corresponding python list, but i'm sure it's long too.

    2. it suits your temperament
    Perl is muscular, idiomatic, expresssive, poetic, ambiguous, robust, a little messy. Python is meticulous, brittle, precise, clear and direct. There are people who prefer that, and it certainly makes it easier to read someone else's code. But less fun.

    3. it's widely-used
    This confers obvious benefits in terms of your employability and versatility. In the case of perl it also gives us cpan, which is priceless, perlmonks, *.pm, and so on. It's not a level playing field, of course: perl's ubiquity is an accident of timing as much as anything. If python or ruby had been a normal part of the unix toolkit when the web exploded, who knows what this site would be called?

    4. it's powerful
    This is really the same as (1) - it can't be taken out of context and still mean anything - except for the fact that your tasks might change, or your understanding of them. If we had to define power, it's probably a product of the range of uses to which a language can be put and its ease and strength in each case. In that context, perl is more powerful than python: it's more versatile, it's easy to grasp and in the hands of a good idiomatic programmer, very strong indeed. But there are well-understood edges to the domain in which perl excels, and C is more powerful still, on this scale. But if it doesn't suit your needs...

    To me, perl is better suited to my work and my tastes than anything else out there, and in my opinion it's a better investment in terms of what it might one day allow me to do.

    but ymmv

    PS. one quite often encounters arguments based on what perl programs are like, rather than what perl is like. If you come across one, make sure that people are comparing like with like. There's a lot of bad perl out there, not because perl is bad but because it's accessible and forgiving. These are good qualities.

Re: Perl VS Python
by John M. Dlugosz (Monsignor) on Aug 05, 2001 at 01:10 UTC
    I don't remember the details, but upon looking at the Python manual a few months ago, it seemed that it was way behind Perl 5. For example, no Unicode support. I found that the next major version of Python was going to address some of these, but don't know the schedule.

    The only thing I could find that Python did "better" was that it compiled down to a byte-code binary, as that was one of its design goals.

    So, grab the Python manual and go though it, and you'll have no trouble finding things to tell your friend about how out-of-date Python is.

Re: Perl VS Python
by archen (Pilgrim) on Aug 05, 2001 at 07:45 UTC
    Perl and Python have very different philosophies. Python is very focused on making syntax easier to read by forcing coding conventions to be followed. Perl on the other hand has gained a sort of reputation for being a "write only" language, as you can create some rather tight code which is unintelligible to all but the Perl interpreter. Realistically though, if someone comments their code adequately and has experience in the language, it shouldn't matter. But most of us (Perl programmers) like the freedom of choosing our own path.

    It basically comes down to the right tool for the job. When it comes to messing with text, I don't think any language can top Perl, and of course Perl does many other things exceptionally well also - but on the other hand there are things which Perl is not good for. Believe me, if Perl loses popularity in favor of another language, it will not be because it's a better scripting language, it will be because it does Perl's job better than Perl. I see Python being a threat to Perl about as much as I see it being a threat to Visual Basic.
Re: Perl VS Python
by strredwolf (Chaplain) on Aug 05, 2001 at 10:28 UTC
    Scrapping the programming aside, let's check out the O'Reilly books:

    Programming Perl: Even in it's second edition, you could program almost anything, including Internet interactivity. It told you everything, and was a traditional manual.

    Programming Python: Gives you an extended diatribe on why Python is good for the body, the mind, and the soul, tells you the basics, and leaves everything else to another book altogether... which is kinda disappointing. In effect, it's C++ programming in a different format.

    If I would compare the two, I would say the Python book is equal to Learning Perl (the Llama book) than the Camel book.

    I'm willing to sell my copy the Python book for half price!!!

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";

Re: Perl VS Python
by targetsmart (Curate) on Apr 14, 2009 at 08:03 UTC
    Not exactly a reply to your post

    Perl has become like a religion to me(3.5 years of meditation).
    But the fact is, for one of the product that I am going to support/maintain/upgrade it uses python heavily, so I must learn python
    I saw some nodes telling about 'perl vs python', perl advocacy here and in some other places like here, here, here, etc
    It is a hard fact to digest that I should know this language to sustain as a developer

    UPDATE
    Interesting one jython


    Vivek
    -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
      I the process of learning python I found the book 'Perl to Python Migration' by Martin C Brown is very interesting and useful. here is the detail
      this is also nice.

      Vivek
      -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
        It seems that I must learn java also, i found this as useful.

        Vivek
        -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
Re: Perl VS Python
by Anonymous Monk on Apr 14, 2009 at 20:33 UTC
    Python syntax is not easy. I recoil at the very thought an interpreter would tell me when to tab. I don't need to be babysat when I type a simple line of code, thank you very much.
Re: Perl VS Python
by morgon (Deacon) on Apr 14, 2009 at 21:00 UTC
    To me Perl, Python and Ruby are pretty much the same thing.

    Some people prefer Perl, others Python, it is (mostly) a matter of taste.

    Perl seems to be a little faster (when your script is counting up to a billion it could save you a few secs) but as most apps are network-bound anyway this is irrelevant.

    Perl has a slight edge with regard to libraries as (I believe) what Python and Ruby have do offer does (not yet) match CPAN.

    For Python and Ruby however there are interpreters written in Java and I think that holds some promise - and a Java-interpreter for Perl will not happen any time soon (if ever).

    For me the most important reason for using Perl rather then Python or Ruby is "market-penetration".

    For instance nowadays (I think) you cannot build a Linux-kernel without Perl, and Perl comes with some comercial software as well (e.g. ClearCase brings it's own Perl).

    So bottom line for me: It's hard to ignore Perl (at least if you work on Unix), so why not use it everyday?

Re: Perl VS Python
by Anonymous Monk on Oct 16, 2009 at 16:20 UTC
    It's been several years since I've used Perl, so when I went to an Open Source Conference, I decided to attend an "Introduction to Perl for Scripting" for a little bit of a refresher; I came out hoping that it will be several more years before I use Perl. Python has certain clear advantages over Perl: object-oriented programming is optional, yet when you need it, it's a LOT simpler than in Perl; you don't need to jump through hoops to create advanced data structures based on lists or dictionaries; if you've always indented code like you're supposed to (for readability ;-) ) whitespace comes naturally, with the added bonus that you don't need curly-braces. Python has disadvantages, too, but the biggest one is that you don't have a powerful macro system that allows you to mold the language to your needs. But then, Python doesn't have that, either. For that power, you need to use Lisp. (This the biggest reason why I decided that I'm going to learn Lisp!)
      ...with the added bonus that you don't need curly-braces.
      I don't see that as a bonus. It gives the "%" key something useful to do in Vi(m?). I don't really see any of your other reasons as disadvantages either (except for macros), but to each his own...
        % is so freaking awesome in python, i'm suprised perl doesnt' use it the same way
        $ perl -e"die q!d %d! % 3" 0 at -e line 1. $ perl -e"die sprintf q!d %d! , 33" d 33 at -e line 1.
Re: Perl VS Python (no VS)
by shmem (Canon) on Oct 16, 2009 at 21:30 UTC
    My co-worker keeps telling me how Python is 'powerful' every single day...

    Invite him to get an alternate view. The computer doesn't "do" anything, and Perl and Python are each just a glass bead game by themselves.

    It's not Python nor Perl which are powerful, it is the mind wielding those tools.

      The problem I have with python is the data typing. Try this in python:
      x = " 10 " # spaces in the declaration y = 5 z = x + y
      I know this is a no-no but the point is this is no problem in perl. In python you need to convert the data into int. I think a scripting language should handle this for the programmer. python also has a datatype "None" which is very annoying. It can be very annoying when you get data returned from a subroutine that is data-type "None" and then you need to figure out how to get it back to a string. That's python. Python also seems to take away the Perl feature of "There's more than one way to do it". I like this feature and I think a lot of Perl programmers do too.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://102231]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-07-29 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (212 votes), past polls