I want to learn a new language...

Michael L Torrie torriem at chem.byu.edu
Wed Feb 14 16:29:50 MST 2007

On Wed, 2007-02-14 at 15:48 -0700, Andrew McNabb wrote:
> Sure, Python isn't perfect.  But it's so simple that I always feel like
> I know where the imperfections are, and I write code without worrying
> about them.

Thought I'd interject with a few of my favorite things to hate about

Most of my issues with python surround the "duck" typing system.  This
works very well for lots of things.  Basically the type of an object
doesn't matter so long as it supports the protocol you want.  Thus you
can use the "for x in " operation on any object that is iter-able.  The
problem is that there's no easy way to discern ahead of time what is
expected when you pass an object to a function.  You can use
introspection to get the built-in docs, ask the function how many
parameters it's expecting, true.  But if the docs don't say, you have no
idea what methods the function is expecting to call on the object until
you try it and get an exception.  This often makes working with
third-party libraries very painful.  I had to run several python twisted
networking apps in a debugger until I figured out just what the
different methods and functions in twisted are expecting, the good docs
notwithstanding.  The source code is essential in finding out some of
these things.  So while I find dynamic typing extremely powerful, it
does have warts.

The other major architectural limitation in python is the GIL, a giant
lock that synchronizes calls to the interpreters core.  Thus
multithreaded programs can not utilize multiple processing units.  In
practice this usually isn't a huge deal.  I'd say much of the time a
multithreaded app is best done with an asynchronous library anyway, like
twisted.  But threads have their place.  Just be aware of this
limitation when doing heavy computations with python.


> Anyway, those are just a few of those thoughts.  Don't tear them apart
> because I didn't try to write some proof of why Python is the greatest
> thing in the world or something.  This is just an attempt to identify a
> few of the reasons why I seem to have more fun in Python than in most
> other languages.  And honestly, there are a lot of other great languages
> out there, and preferences really are subjective.
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */

More information about the PLUG mailing list