Python vs. Perl, which is better to learn?

Alex Martelli aleax at aleax.it
Thu May 2 17:19:29 EDT 2002


John J. Lee wrote:

> On Wed, 1 May 2002, Alex Martelli wrote:
> [...]
>> It may or may not be worth superficially learning both Perl and Python
>> before going in depth into either (if it is, then I think Ruby should
>> also
>> be in the mix).  But "variable markers" are still quite a deep
>> difference.
> 
> What differences did you have in mind, between Python and Ruby, that are
> really significant?  I've always lazily assumed there are none (based on
> a few minutes scanning of a web page or two).

Ruby's built-in classes are modifiable -- so you can instantly change
the behavior of all existing strings, for example.  Python, while highly
dynamic, draws the line quite a bit short of that.

Ruby's approach to iterators is close to Smalltalk's - you pass an
unnamed code block as an argument to a method.  In Python,
iterators 'extract' values linearly, and the code block that handles
one value at a time is typically placed as the body of a for statement.
Sort of inside-out from each other, and not exactly overlapping in
terms of what each approach makes it easy to do, though close.

Ruby's closer to Perl in many small details, although, as I understand,
some are deprecated (in the original sense, i.e., "they're there but we're
sorry they are"), such as the ability to call functions without parentheses
in certain cases, or special global variables with strange (non alphameric)
names.  I guess these shouldn't count as "deep".


Alex




More information about the Python-list mailing list