ESR "Waning of Python" post

Peter J. Holzer hjp-python at hjp.at
Fri Oct 12 14:39:48 EDT 2018


On 2018-10-11 17:56:43 +0000, Neil Cerutti wrote:
> On 2018-10-10, Paul Rubin <no.email at nospam.invalid> wrote:
> > Neil Cerutti <neilc at norwich.edu> writes:
> >>
> >>> the GIL (15/16th of his CPUs are unused..)
> >> Channels are a big selling point of Go, no argument there.
> >
> > The unused CPUs are not about channels (Python has Queue which
> > is similar).  They're about the GIL, which is an implementation
> > artifact of CPython that's hard to eliminate without modifying
> > CPython's C API.  ESR didn't say this explicitly but it came to
> > mind when reading his post: It's weird that Python's designers
> > were willing to mess up the user language in the 2-to-3
> > transition but felt that the C API had to be kept sarcosanct.
> > Huge opportunities were blown at multiple levels.
> 
> OK. I assumed he planned to parallelize computations in Go by
> offloading to concurrent channels--

You mean goroutines, not channels. Channels are a mechanism which
goroutines use to communicate with each other. In Python terms,
goroutines are sort of like threads, channels like queues.

> I guess I don't understand why he can't do that in Python.

The Go runtime can efficiently distribute goroutines over all cores. The
CPython runtime can't do the same with threads (mostly because of the
GIL, as already discussed). You can run several Python processes and let
them communicate via some IPC mechanism (indeed the Python
multiprocessing module provides Pipe and Queue classes for this
purpose), but IPC is generally more expensive than communication within
the same process. So the overhead may be too hight if you need very
fine-grained communication.

> I imagine that if I stuck with Go long enough I'd develop a new coding
> style that didn't inolve creating useful data types.

I haven't used Go for any real project yet (that may change next year -
we'll see whether I love it or hate it), but I don't see why you
wouldn't create useful data types in your Go programs. Go isn't
object-oriented, but that doesn't make its type system useless (I've
certainly created lots of useful data types in C).

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20181012/786a3065/attachment.sig>


More information about the Python-list mailing list