Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Alan Gauld
 friend told me I should learn Perl over Python as it's more
 prevalent.  I'm going to be using it on a Mac.

In that case you should switch to a PC because they are more prevalent.
Also you should learn to program in COBOL since its the most prevalent
of all computer languages.

And yet most folks in the industry prefer Macs to PCs when they have
a choice and most unbiased observers think COBOL sucks!
Python is a lot easier to learn and work with than Perl...
go figure. :-)


-- 
Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Jan Eden
Hi Scott,

Scott Clausen wrote on 30.10.2005:

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.

I started learning Python approx. 4 months ago. I had been using Perl for about 
4 years at that time. (BTW, I work on a Mac, too)

The motivation for trying Python came when a certain project needed an OOP 
overhaul. While I was able to code an OOP version of the program, the result 
was rather slow and ugly. This was only partly because of my own deficiencies - 
Perl does not really invite you to produce clean code on larger projects (IMHO).

When I re-coded the very same project in Python, I achieved a much better 
(faster, more readable) result within weeks.

Most comparisons of Perl and Python also highlight Python's cleaner syntax, I 
can second that (although I got used to Perl's @$% syntax after a while).

Cheers,

Jan
-- 
Common sense is what tells you that the world is flat.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Liam Clarke
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


Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Andrew P
If you are interested in learning another tool, please, start with
Python.  If you are interested in scripting UNIX, Perl is a fine
choice.  There prevalence matters, and quite a bit.  But sys admins
are usually very Perl-centric, and in my experience monolingual, and a
bit of an insular community :)

Python is more than the equal of Perl by any measure.  Including
system administration.  But moving beyond that is also a lovely
language for building applications, and everything from lightweight
CGI scripts to using hefty web frameworks, of which there are plenty
to choose from.

Perl is a language of exceptions to the rules.  Python tries very hard
to be consistent, which makes it much easier to learn, and much easier
to use, and much, much easier to apply the concepts you have learned
to other languages.  Including Perl, as a second or third language.

Perl can be coerced into big jobs, but it's not very pleasant.   The
best you can hope to keep in your head at once is your own set of
idioms, which will -not- match anybody elses, and will likely change
from week to week on you anyway.   And really when people tell you
they can't read what they wrote the day before when they come back to
it, they aren't lying!

Having said that, I love Perl, because it -is- quirky and sprawling
and lovable.  It's pretty much the worst case scenario of
everything-and-the-kitchen-sink, and really not so bad for all that,
and definitely more fun for it.  So if that appeals, then you'll have
fun too.

But Python tends to be compared to general purpose languages like Java
and C++ more often.  OOP heavyweights of the world.  Actually, let me
find that quote by Bruce Eckel, who wrote the (very) popular Thinking
in Java and Thinking in C++ books.  Here it is:

I believe it was definitely worth moving from C to C++, and from C++
to Java. So there was progress there. For something as advanced as
Python is over those languages -- and as different -- there will be
some hesitation.

And:

When you have the experience of really being able to be as productive
as possible, then you start to get pissed off at other languages. You
think, 'Gee, I've been wasting my time with these other languages.'

That second quote applies to many language vs language comparisons,
obviously.  But it's food for thought.

Oh, and never underestimate the power of the interactive interpreter! 
Don't do it!  Ever!

Take care,

Andrew

On 10/30/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.

 Scott
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Newbie Question - Python vs Perl

2005-10-31 Thread Tim Johnson
* Scott Clausen [EMAIL PROTECTED] [051030 16:30]:
 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.
 
  Prevalent? So what? Forget Perl entirely. Learn python and rebol 
  (www.rebol.com). At the same time.
  That's how we trained programmers here.
  Rebol arguably exceeds both python and perl in terms of sheer
  productivity on a line for line basis, but has a very small 
  user base and fewer modules.

  But the bottom line is to be multi-lingual. 
  Here's a pretty standard coding day for me.
  1)Write rebol code which parses html and generates python, perl
   and javascript code for deployment.
  2)Write python code for the deployment (front end), database
   interaction, server-side data validation etc.
  3)Write Javascript for client-side data validation, dynamic
html etc.
  4)Write elisp code to enhance productivity of my Emacs and Xemacs
Editors.
  5)Use vim/gvim for system wide analysis and editing.

  I believe the rebol is pretty straight-forward and easy to
  install for the mac.

  I use Python for most of the services used directly by customers
  on larger projects 'cuz it scales better (for me). and python teaches
  me good coding practices. IOWS, coding in python makes me a better
  rebol programmer too.

  The bottom line is don't get stuck on one programming language.
  I've seen new programmers go thru a fast learning curve, pick up
  something faster than an ol' fart like me would, but get so
  settled in one programming niche or another that they can't or
  won't change. Not good!

  I think python is the best way to learn *good* programming.
  MTCW
  tim

 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.
 
 Scott
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor

-- 
Tim Johnson [EMAIL PROTECTED]
  http://www.alaska-internet-solutions.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Newbie Question - Python vs Perl

2005-10-30 Thread Kent Johnson


Scott Clausen 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.

http://wiki.python.org/moin/BeginnersGuide/Overview
http://www.linuxjournal.com/article/3882

You might be interested in this site that lets you compare Python and Perl code
http://pleac.sourceforge.net/

-- 
http://www.kentsjohnson.com

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor