Re:Project Euler
by oldandtired on Sunday December 10, 2017 @10:56PM
(#15895061)
and Python got this from....? (which language)
Well Python got it from Haskell. I thought I made it clear enough.
Re:Project Euler
by oldandtired on Monday December 11, 2017 @05:16AM
(#15896154)
Well years ago, I saw a discussion that put this in the context of python's generators being inspired by what was in Icon.
Re:Project Euler
by bunderbunder on Monday December 11, 2017 @08:55AM
(#15897012)
I'm just now looking at Icon code for the first time, but, to me, Python's list comprehension syntax looks more similar to Haskell's than Icon's.
By the way doesn’t the original problem say exclude multiples of 15?
IMO Python’s generators and coroutines are one of its most useful yet least appreciated features. Being able to suspend a function, resume it, get values from it, send values or exceptions to it is a highly powerful feature. You can use them to implement user-space cooperative threads, write a scheduler for that, implement message-passing concurrency, and do highly efficient multiplexed I/O in the style of asyncio.