Python & Go
Terry Reedy
tjreedy at udel.edu
Sat Nov 14 17:10:50 EST 2009
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.
def plurals():
i = 2
while True:
yield i
i += 1
def primefilter(src, prime):
for i in src:
if i % prime:
yield i
src = plurals()
while True:
i = next(src)
print(i)
src = primefilter(src, i)
As I commented there
"It stopped at 7877 when it hit the default recursion limit of 1000,
which could easily be increased to get out-of-memory error instead.
I think Google is making a blunder if it moves to another old-fashioned
language whose code is bloated with junky boilerplate that doubles the
size. It would be much better, for instance, to tweak Python, which it
has had great success with, to better run on multiple cores."
Terry Jan Reedy
More information about the Python-list
mailing list