On 10/31/05, Scott Clausen <[EMAIL PROTECTED]> wrote:
> As a newbie to Python I'd like to know if someone can tell me some
> strengths and weaknesses of this language. The reason I'm asking is a
> friend told me I should learn Perl over Python as it's more
> prevalent.  I'm going to be using it on a Mac.
>
> I'd appreciate hearing any views on this topic. My own view is that
> it's always good to learn new things as you then have more tools to
> use in your daily programming.
>
> Thanks in advance.
>

Hi Scott,

I would say, it really depends on where you're coming from and where
you're going, coding wise. If your background is primarily Linux
scripting with sh, awk, grep, sed, (sed?) etc, then Perl will be a
nice and natural fit.

If you're starting from a clean slate, then I would recommend Python,
speaking as a relative beginner who had to make that choice myself not
too long ago.

Python has a nice clean syntax, which means that your errors are
usually errors of logic and not errors of using an @ instead of a $,
or missing a }, etc.

Perl has an incredibly huge library, and for a beginner, that's
challenging. Python's standard  library encompasses about 98% of
everything I need to do, and in a year of coding in Python, I'm still
not familiar with all of it, but I have a fair idea of where to find
particular functionality. I tried Perl and got incredibly confused by
CPAN.

Python is OO from the get go. Want to subclass integers? Sure, go right ahead.
Whereas, Perl tends to show it's roots in aforementioned shell
scripts, and the OO side feels awkward.

Also, I'll just mention a pet peeve of mine regarding Perl. It
flattens lists using the simple syntax. To nest a list requires
special syntax that most tutorials don't mention...

The classic reasons to prefer one over the other are a) scalability,
and b) maintainability.
Python scales well, and is quite straightforward to maintain, although
I live by the mantra that one can write Perl in any language.

The catch-cry of Perl is "there's more than one way to do it." As a
learner, you'll spend a lot of time asking "But which is the best
way?" In Python, there's generally a straight-forward and obvious way,
and it's usually the best and simplest.

i.e. you can stick the items of a one list in another two ways, a for
loop, and a list method.
x=[1,2,3]
y = [4,5,6]
#either
for item in y:
    x.append(item)

#or
x.extend(y)

The extend() method is simpler, and faster.

With regards to where you're going in the future, I don't know what
the future holds for Perl, but watching the .NET framework arise, I
think that Microsoft has the LAMP combination in it's sights. There's
already a Python implementation for the .NET framework, it's called
IronPython, (it's in alpha at the mo).

To be honest, if you still wanted to go with Perl, I'd recommend you
learn Ruby instead.
It originated in Perl, but it's just flat out better. It's the
language that experienced Perl users migrate to, as it has minimal
culture shock. And, Ruby on Rails is a great framework.

Ruby's standard library is quite minimal on the docs at the moment,
and the 3rd party modules aren't there, yet, whereas Python has a
mature community.

Good luck,

Liam Clarke
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to