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.
This might be fixed some time or never. There is little push for ultimate performance and actually identifying arithmetic forms in recursive loops in the front-end is hard. (Heck it sometimes fails to tail optimize.)
The sum of x for x from one to 999 where x mod three is zero or x mod five is zero.
well, the bit in square brackets is a comprehension. `sum `is just ordinary function application.