Python & Go
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:
>> 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
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:
and here about it no going away soon:
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...
More information about the Python-list