Using python as primary language

Chris Mellon arkanes at gmail.com
Thu Nov 8 18:38:27 EST 2007


On Nov 8, 2007 5:22 PM, Michael Bacarella <mbac at gpshopper.com> wrote:
>
> > > How do you feel about multithreading support?
> > >
> > > A multithreaded application in Python will only use a single CPU on
> > > multi-CPU machines due to big interpreter lock, whereas the "right
> > thing"
> > > happens in Java.
> >
> > Note that this is untrue for many common uses of threading (e.g. using
> > threads to wait on network connections, or calling out to most common
> > compute-intensive C extensions), where the GIL is released and
> > multiple CPUs are used just fine.
>
> It's true in exactly the case where you would gain the most benefit
> from multiple CPUs.  So I'm not sure how uncommon that is.
>

It's pretty uncommon. There are relatively few CPU bound tasks that
are a) highly parallel and b) can't be easily scaled between
processes. Python is not (by itself) an especially good tool for those
tasks.

I find that, by far, the most common use of threads (especially in
Java applications) has more to do with the designers lack of knowledge
of other concurrency models than any particular benefit of the
threading model.

Python is excellently suited to be the "primary language" for pretty
much any company because of its flexibility and (especially) it's
willingness to play nicely with other languages and environments. It
isn't well suited to being the *only* language used, and I would argue
that no language is - lots of companies to try to treat C#/.NET or
Java as the One True Language and suffer for it in stagnant, expensive
development, cumbersome library use, and lack of flexibility.



More information about the Python-list mailing list