X vs. Y is a common direction that many threads take, in many discussion forums, on many radio stations, in many news broadcasts, and in many political arenas.

This post is another X vs. Y. However, unlike the majority of X vs. Y -- heck, let's even start getting more specific and say Perl vs. Python -- debates, this thread will attempt to measure the differences between these two languages by looking at differences on the coding level. Rather than just "well, it's just easier to do task XYZ in Python/Perl" I intend to do a bit of character-by-character analysis (I think you'll see what I mean) to show you why lately I've taken great interest in Python.

In fact, I'm even yearning to understand why Perl still manages to exceed the popularity of Python.

If you think this is a flame against Perl though, you've drastically missed my point. I'm here to present, from a coding standpoint, why I've come to see Python as an extremely cool language...for me, more useful than Perl I believe, and from there, to be shown -- by you, the viewer -- the contrary to my viewpoint.

Allow me to begin:

Now...all of the above issues are what I would consider agnostic in religious flame wars. They show specific examples of how Python let's you type fewer characters, and/or do things in a cleaner syntax and/or in ways that lend to automating away tasks like creating HTML or PDF documentation of your code without having to know any special syntax to do it. On the religious side, many people reject Python because it uses indentation levels to group statements. With respect to Perl programmers, there are two serious flaws in this argument:
  1. It amounts to the same argument that non-Perl programmers use in saying "Perl sucks because it looks like line noise". You'll note in my illustration of why I seem to prefer Python these days, I've not used such an argument.

  2. If you wrote a simple parser to remove all the {}'s from Perl code blocks, you'd notice that Perl's code blocks would look EXACTLY the way Python code looks, because indenting code is a requirement of good coding practice.
So, there you have it. An empirical (yes, I've come up with these points from actually having used Python to do everything from script my IRC client, to writing a weather reporting module, to producing an online drugstore for a client) essay on why I think Python seems to win on most counts when measured against Perl. And before you suggest that it seems most points made seem to just say "you type less in Python" a.) carefully reread them because there's definitely more to it than that, and b.) ask yourself...even IF the languages were equal on every other count except that one allowed you to type fewer characters to get your job done, wouldn't you prefer the route of less typing? :)

Please show me a contrary, and equally backed up, viewpoint on this debate. For reasons already cited "it sucks because it uses whitespace to group statements" or "Perl is better because it has default variables" don't fly. That's 100% pure opinion. The points I've shown above are concrete examples of why, even with best coding practices, character for character, and due to language design issues you will save characters in Python, and also shows specifically why it's easy to write tools to autogenerate Python module documentation without knowing any special documentation syntax.

Warning: If you say something about Perl vs. Python in clear ignorance of, and obviously rarely having used, Python, You Will Be Flamed.

Heh.


In reply to Perl vs. Python: Looking at the Code by mothra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.