Whats so good about Python?

Russell E. Owen owen at nospam.invalid
Wed May 8 14:38:02 EDT 2002


In article <8580b02e.0205071527.5b6ce52f at posting.google.com>,
 usawargamer at yahoo.com (BHE) wrote:

>People have said good things about Python but Ive never used it.
>I use Perl and Java and C++.
>
>My question is:  What does Python offer me over Perl?  I dont use
>object oriented Perl (which I consider innapropriate) and dont want a
>hackers approach.
>
>If Python is a superior languiage thats here to stay, and a better
>language than Perl I'll consider learning it.  I use Perl for
>scripting, file manipulation, database retrieveal and stuffing, report
>generation.
>
>
>(I'm not looking to provoke a fight between Perl and Python backers. 
>I'd like to know what Pythons strengths and weaknesses are).

Syntax is a big plus for Python. Functions have named arguments (no need 
for @ unpacking). Lists and dictionaries (associative lists) can contain 
arbitrary items including other lists and dictionaries. The syntax for 
objects and exception handling are clear and readable.

I think Perl's syntax is probably a bit more efficient for quickie text 
processing scripts, but it starts to get in the way for larger things. 
By comparison, Python is good for small scripts and also good for larger 
tasks. It scales nicely and is readable.

Nothing is perfect. Things I don't like about Python include (everybody 
will have their own list, of course):
- The type/class unification problem. This is *much* improved in recent 
Python but still has further to go.
- There is a sometimes uncomfortable (to me) mix of global functions, 
operators, etc., meaning more trips to the docs than I'd like. For 
instance collection classes don't have a len or length method, you call 
the global function len on them. As a result, it is sometimes challenge 
finding the way to do something. Still, it is better than it was. At one 
time there was a string module full of functions rather than methods on 
string objects.
- The date and time library is pretty primitive.
- Lack of explicit variable declarations. This makes use of local 
variables vs variables you can see because you are in another function's 
scope a minefield.
- You should not use mutable objects (such as lists or dictionaries) as 
default arguments for functions. It doesn't work the way one might 
expect, and most folks stumble across this sooner or later.
- The need for "self" to be an explicit argument to object methods.

-- Russell



More information about the Python-list mailing list