Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

perl python compare

by bhupeshwalde (Novice)
on Mar 28, 2011 at 07:16 UTC ( #895852=perlquestion: print w/ replies, xml ) Need Help??
bhupeshwalde has asked for the wisdom of the Perl Monks concerning the following question:

Why perl is better than Python?With any feature compatibility?

Comment on perl python compare
Re: perl python compare
by Corion (Pope) on Mar 28, 2011 at 07:19 UTC

    Perl has only one way to do it for module distribution. Where Python is a fragmented landscape of "roll your own", "upload to anywhere" modules, Perl only has one central repository for source code, http://search.cpan.org, and one way to install it.

Re: perl python compare
by Anonymous Monk on Mar 28, 2011 at 07:40 UTC
    Why are such questions often posted by users with low post count, no matter what forum or language is concerned?

      Because they're just as clueless about manners and community norms as they are about the homework they have no idea how to complete on their own?

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Re: perl python compare
by vkon (Deacon) on Mar 28, 2011 at 07:44 UTC
    In python, you do not declare variables, so you're in danger of accidental fail due to typo in variable name.
    in perl - you usually use strict; and such typos detected early at compile time.

    Also, python regular expression have inconvenient syntax, compared to perl.
    They have same power, but in python you must be noisy - you run regex, then you use it - in perl this is in one go, much cleaner.

    Due to propaganda and some luck python it is widely believed that it is cleaner, but actualy it is vice versa.

Re: perl python compare
by moritz (Cardinal) on Mar 28, 2011 at 07:55 UTC
      Do you realize that the thread is almost a decade old.
Re: perl python compare
by JavaFan (Canon) on Mar 28, 2011 at 13:49 UTC
    Why perl is better than Python?
    It isn't. Python is a brilliant language, ideal not only for beginners, but for experts and wizards as well. Perl on the other hand is a write once, impossible to read bag of line noise. Which is why Perl wussies so much like CPAN - they'll never have to read, much less understand the alien code. Python syntax is very easy to read and understand, so Python programmers never have the need to use the dogma "don't reinvent the wheel" as an excuse to go back and improve code once written. That's why Python programs (and programmers) get better over time, while Perl is just a swamp of stagnation.

      It is very easy to write illegible code in any language and Python is no exception to that rule.

      It is very easy to write incomprehensible code in any language and Python is no exception to that rule.

      It is very easy to write inefficient code in any language and Python is no exception to that rule.

      It is very easy to write unportable code in any language and Python is no exception to that rule.

      Perl is not holy, but neither is any other programming or scripting language. I'd even say there is no perfect language. Each language will serve its own public and audience. I've been confronted with problems with both languages in the past, and if you look though what you say is write-once code (and there are enough ways to make that readable fast if needed), I have found that fixing failures in perl is waaaaaaay easier than fixing problems in python. But of course YMMV.

      Perl is a brilliant language, ideal not only for beginners, but for experts and wizards as well. Python on the other hand is an ugly language that cannot be moulded into something beatiful because it thinks "There Is Only One Way To Do It" would be ideal for anyone (but me). Python syntax might be easy (easier) to read than Perl's syntax (for beginners that is), but that is by no means a guarantee that that syntax is better, more efficient or easier to maintain. As python only gives you one wheel, if that wheel doesn't work you're fucked, as there is no other wheel available. The only options in that case imho are 1. give up, 2. use perl. That is why python programs are left to die and perl programs keep evolving.

      Just my view on the matter. And no, I do not hate Python. There is a best tool for every problem. Quite often that is not Perl, but most often it is not Python.


      Enjoy, Have FUN! H.Merijn

        Adding to it, I would also say

        Python's whole idea of slowing down a programmer and restricting freedom at the expense of readability(Supposedly) is big turn off. If I want to move slow, I would never ever use a scripting language. Moving slowly I can achieve the same tasks with C/C++ lot more efficiently than in Python. Im onto scripting for the power and pace of development.

      Honorable abbot of the monastery!

      Curiosity almost kills me ... why are you still using Perl? :)

      Cheers Rolf

        Penance.
      Your assumption that Python is some sort of a magical entity that when one touches it transforms a bad programmer into a genius is so childish.

        Some people believe you don't have to program to write Python code; you can get by writing pseudocode which, somehow, magically works.

        Your assumption that Python is some sort of a magical entity that when one touches it transforms a bad programmer into a genius is so childish.
        Oh, yeah, such a notion would be childish.

        It's of course not true. Programmers don't go from evil to good by just touching a language, no, sir! Instead, the choosen language is a function of the programmers alignment. Good programmers choose Python. Evil programmers choose Perl. There's a scale of good to evil languages: (good) Python - .Net - Java - C - Ruby - C++ - Intercal - PHP - Perl - Perl6 (evil). Look at the language of choice, and one can instantly see whether a programmer is good or evil. Python programmers are cheerful, care for the environment, help cross old ladies across the street, write maintainable programs, and have a good sense of humour (Python is named after Monty Python after all). Perl programmers are grumpy, steal candy from babies, don't care about the environment (just look at all the flying around the world to attent their navel staring so-called "conferences"), write unreadable programs, and wouldn't recognize an ironic post if beaten to death with it. But what would you expect from a language created by a man who is dull enough that he first had to read the dictionary cover to cover to find a name for the language. After trying out his wife's name, and then picking a name already taking by someone elses language. Evil language, evil programmers.

Re: perl python compare
by LanX (Canon) on Mar 28, 2011 at 18:12 UTC
    They are equally good, both start with a P ... but as I notice now, Python has 2 letters more!

    Cheers Rolf

      Python has 2 letters more

      which of course tells you why Perl code is smaller, faster to write and easier to comprehend - it avoids extra clutter.

      True laziness is hard work
Re: perl python compare
by Anonymous Monk on Mar 29, 2011 at 03:20 UTC

    My $0.02

    There are many reasons why Perl is preferable over Python. To summarize them all. I think Perl is still the only option in your tool set if you get a task at 1 in the night and expected to finish that in an hour. That means that there are a certain things that about Perl that make it the best scripting language in the class. Sure everything that is possible in Python is possible in Perl too, but that sort of mathematical possibility is not what tools are about.

    1. Flawless integration with the UNIX system. The language has perfect integration with the shell and the entire UNIX system as a whole. As far as text processing is concerned no other language holds even a candle to Perl. Any thing to do with the word text and there you go, all you need and have is Perl. Python has text processing too, but it looks so cumbersome and difficult that it becomes a pain as soon the number of regexes hit anything more than 5. You get caught up in an never ending mess of compiling, matching and catching exceptions even for simple tasks. On top of that functions like grep, things like qr and smart matching features of Perl make text processing not just easy but look so natural and native to the language. Regexes are first class citizens in Perl, now that's another added advantage. Try the combination of iteration, smart matching and too many regexes in Python, You will instantly realize what sort of mess Python code looks like.

    2. Freedom, Power, Flexibility and rapid pace of getting job done. As Chris Prather says - Perl prefers configuration over convention in Code!. Python on the other hand is designed with restriction and sacrifices too much power, flexibility, freedom and pace of getting job done to achieve what it calls 'Readability matters'. I don't know about others but I prefer a sharp double edge sword to a blunt one. I mean to say, Perl will help you be creative. It will make you thing in many ways. It will help you come out will many solutions and good solutions over time. I prefer freedom and power over bluntness. Python's claim that it helps people write good code automatically is foolish. Only thing that solves a bad programmer problem is a good programmer. For me this whole idea of restriction of freedom to the programmer is the biggest reason why I hate Python. Anything that comes in between my freedom and creativity is not for me. Besides a tools that forces you to be something, will eventually group you into same group of fools who were themselves forced to be so.

    3. CPAN, Nothing like this exists in other language. And only seeing it manually can make you believe it. By the time one can think of a 'only one way to do it' solution in Python, You would have solved the problem with CPAN.

    4. The Perl community. Perl monks, the mailing lists, the helpful people. And people with the most passionate hackers in the community.

    5. Stable and back ward compatible software. Perl hasn't broken backwards compatibility since its existence. Python on the other has broken backwards compatibility to modify just a print statement and a couple of iterators in Python 3. With Perl I can be sure 4-5 years down the lane the porters will ensure my old code runs smoothly then. With Python I would have worry about the migration mess.

    6. Evolution and syntactical flexibility with backwards compatibility. Advances like Moose and Devel::Declare(And all associated modules) give the power of extensibility without worrying about breaking backwards compatibility.

    Of course a detailed analysis will run into volumes. But its not exactly the technical stuff that attracts me to Perl. Its the Perl philosophy.

      Could you please elaborate how Devel::Declare is backward compatible?

      And when complaining about Python 3 you should keep in mind that Perl6 also breaks compatibility.

      Cheers Rolf

        Devel::Declare is a module, Perl 6 is a new language which wishes to co exist with Perl 5. Whereas Python 3 wishes to REPLACE Python 2. Unfortunately with Python that's not an option. Not that its surprising. Python's syntax is rigid enough, any thing that is even close to changing/modifying/updating or getting a better syntax will break Python's back ward's compatibility.

        If your only goal is 'readability matters', you shouldn't be surprised when programs get difficult to write over time.

Re: perl python compare
by holli (Monsignor) on Mar 29, 2011 at 10:48 UTC
    Python does not support real closures/anonymous functions.


    holli

    You can lead your users to water, but alas, you cannot drown them.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-12-19 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls