Python & Go

Yoav Goldberg yoav.goldberg at gmail.com
Sun Nov 15 19:40:53 CET 2009


On Sun, Nov 15, 2009 at 4:00 AM, Terry Reedy <tjreedy at udel.edu> wrote:

> Yoav Goldberg wrote:
>
>
>> On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy <tjreedy at udel.edu <mailto:
>> tjreedy at udel.edu>> wrote:
>>
>>    Paul Rubin wrote:
>>
>>        Mark Chu-Carroll has a new post about Go:
>>
>>
>> http://scienceblogs.com/goodmath/2009/11/the_go_i_forgot_concurrency_an.php
>>
>>    In a couple of minutes, I wrote his toy prime filter example in
>>    Python, mostly from the text rather than the code, which I can
>>    barely stand to read. It ran the first time without error.
>>
>> Yes, but the cool thing about the Go version is that it does each
>> generator in a different thread, so in theory it could run twice as fast on
>> a multi-core machine.
>>
>
> Which is why I added, in my opinion, that "It would be much better, for
> instance, to tweak Python, which it has had great success with, to better
> run on multiple cores."
>
> For instance, add a new keyword 'go' such that
> go def f(): yield 1
> runs the generator in a different thread, possibly on a different core.
>
> [...]


> I see no reason why we cannot have that with Python. I not even sure we
> cannot have it with CPython, but I am not familiar enough with threads,
> processes, and CPython internals.
>
>
> Yes, this could work, and would really cool.
I believe you can go a long way with annotations, and maybe even provide a
full working demo.
So we can definitely have this in python, and it could be a really cool
feature.
Having it in CPython, though, is a different story altogether -- CPython way
of handling threads is problematic, and not going to change soon, see here
about the problem:

http://blog.snaplogic.org/?p=94

and here about it no going away soon:

http://www.python.org/doc/faq/library/#can-t-we-get-rid-of-the-global-interpreter-lock
http://www.artima.com/weblogs/viewpost.jsp?thread=214235


So, yes, we could have this in python, but no I don't see it happening very
soon.. And the compiled Go is really different in design than python -- easy
to parse, easy to compile, static, works fast, etc.  Different language.  Is
it a good thing to have a different language and not base yourself on an
existing one? Not sure.  But that's a different debate.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091115/ea255240/attachment.html>


More information about the Python-list mailing list