Perl vs. Python: A Culture Comparison
davemabe writes "Every programmer has a favorite scripting language. Here is a well written article by Jon Udell from byte.com detailing the differences between Perl and Python, their cultures, OOP, database access, philosophies, and which one will gain the most converts in the future. Very interesting reading on an almost religious debate. "
Re: Jon Udell's: "A Perl Hacker in the Land of Python" (http://www.byte.com/feature/BYT20000201S0001)
Well, since someone else mentined it, here's a reaction I had to an
email conversation where the Udell URL was cited. Take it or leave
it... but I finally pinned down what I think is wrong with Wall's
initially rather intriguing 'philosophy':
You know in Perl the motto is "there is more than one way to do it".
Larry Wall takes this by way of a linguistics background, and wants
to make Perl resemble a natural language. In contrast--at least at a
syntactic level--Python has fairly clear rules about what something
*has* to look like, and there tends to be a high degree of
orthogonality (which Wall vehemently eschews). There were some
remarks like this in the article. (Obviously, in terms of semantics,
large-scale design, and algorithms, there are many ways to do a thing
in any language).
I think Perl succeeds in what it is trying to do. For that reason,
it really does often look like a "write-only" language. You can
easily express your own "thoughts" fluidly and naturally... the
problem is that they are then as difficult to unpack later as a poem
or a complex philosophical sentence (good uses of natural language).
The thing that Wall &gang seem to miss is the distinct registers of
natural language. The whole thing is very rich in expressivity, and
highly non-orthogonal. But that is absolutely *NOT* the case when it
comes to specialized areas of natural language where clarity and
precision are at a premium. I *WANT* air-traffic controllers to
speak in a highly structured, syntactically and lexically limited,
and stereotypical fashion! I really *DO NOT* want them to use free
verse! To a somewhat lesser extent, I also want programming specs or
technical documentation to follow a rather rigid pattern. When I
look in the help file, it makes my life a lot easier if the list of
parameters to a function are always described under the same heading,
with a consistent and fairly small subset of English words, and with
an attention to consistent whitespace, layout and special characters.
The moral is that Perl is a great language for *implementing*
haiku... but Python is rather better at implementing functional
specs.
Yours, Lulu...
Buy Text Processing in Python
The two monks stand side by side, facing the altar, behind which a graven image of the Great and Benevolent Tux stands with wings half spread as he contemplates the GNU/Path to True Enlightenment Through Open Source. One monk wears a single pearl upon his forehead, glimmering in the flickering light of the altar candles. The other sports a torc in the form of a serpent entwined around his upper arm. The gaze upon the image of Tux placidly, each at inner peace.
The monk with the pearl breaks the silence: "Good brother, I see your movement grow by leaps and bounds. How is this so?"
The monk with the serpent replies: "It is our more disciplined coding, brother, which more quickly leads down the One True Path of Enlightenment. Discipline of code leads to discipline of mind and body."
Pearl: "But what of tailoring the Quest to the individual? Be flexible like water, and in time, even stone will fall before it."
Serpent: "Be structured like iron, and the stone will fall faster."
Pearl: "But each mind is different, and should be allowed to find their own path."
Serpent: "There is but one Path, brother, just many ways to find it. Ours is the quickest and most sure."
The candles on the altar continue to flicker as the two monks fall into a few moments silent contemplation.
Pearl: "I am afraid I must disagree."
Serpent: "So you say, but you know the truth in your heart. Did not your order adopt the doctrine of OOP despite the conflicts with your order's earlier, strictly procedural ways?"
Pearl: "OOP is just one path of many."
Serpent: "It is the soul of the Way."
Pearl: "And so you seek to challenge the longstanding authority of the Order of the Pearl? We have existed longer, and are closer to the Truth!"
Serpent: "You wander blind in the mists, poor deluded souls, while the True Way beckons! You can yet change your $PATH."
Pearl: "You speak heresy! Leave the Holy Temple before the Great and Benevolent Tux smites you!"
Serpent: "I speak Truth, and you are but too mad to see it! I curse you and your Order! The Way of the Serpent will triumph!"
And the monk with the serpent turns and stalks out of the Temple, growling, "We will be back, and in numbers! The Temple will be ours!"
The monk with the pearl watches his counterpart leave, turning back to the altar and shaking his head. "We will be waiting, and the Great and Benevolent Tux is on our side!"
-- WhiskeyJack, on serious caffeine withdrawal.