Why should I switch to Python?

Grant Griffin g2 at seebelow.org
Fri May 12 17:35:58 EDT 2000


andres at corrada.com wrote:
> 
> On Thu, May 11, 2000 at 12:09:07AM -0500, James Felix Black wrote:
> > > Two big ones come to mind: using complex data structures, and
> > > modularizing your code. Both are much easier in python.
> >
> > I won't dispute your second point, but I don't understand your first.
> >
> > I'm not sure exactly what you mean:
> >
> > %friends = { Bob => [ ], Jane => [ "Lisa", "Mabel", "Freddy" ],
> >              Lisa => [ "Mabel" ] };
> >
> > for $name (keys %friends) {
> >   print "$name has these friends:\n";
> >   for $f (@{ $friends{ $name } }) {
> >     print " ", $f;
> >   }
> >   print "\n";
> > }
> >
> > Sure looks similar, doesn't it?  Of course, the de-referencing of the
> > array reference looks bizarre, and perl doesn't have the wonderful REPL
> > loop, but the assignment is almost completely identical to the python
> > syntax.
> >
> 
> C'mon, let's be reasonable about this. Only die-hard Perl programmers can
> love the syntax of that language when it comes to complicated data
> structures. I quote from "Programming Perl", pg 243, emphasis mine:
> 
>    "For both practical and philosophical reasons, Perl has ALWAYS been biased
>     in favor of flat, linear data structures."
> 
> One of the main reasons I came to Python was that I got tired of coding
> complex data structures in Perl and getting them wrong. Unless you are
> constantly creating these structures, you forget Perl's convoluted syntax.

Or in my case, never completely learn it.  I had forgotten about that as
a major shortcoming of Perl.  The system Perl uses is flexible, but
undeniably awkward.  It stands in stark contrast to some of Perl's other
very brief, very handy constructs.  I consider Perl's argument passing
system to be a step backward compared to C.

In comparison, Python's approach is a step _forward_ compared to C and
even C++, with its support of keyword arguments.

perl's-inconsistency-is-its-most-consistent-feature-<wink>-ly y'rs,

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation	      http://www.iowegian.com



More information about the Python-list mailing list