fromAlex MacArthur1 week agoJavaScriptI used a generator to build a replenishable queue.Use generators plus promises to implement a replenishable FIFO queue that stays alive and pauses when empty, resuming when new items arrive.
fromAlex MacArthur8 months agoReactI think the ergonomics of generators is growing on me.JavaScript's recent syntactic sugar enhances programming by addressing real pain points, while the practical use of generator functions remains less established.
PythonfromMathspp2 months agoA generator, duck typing, and a branchless conditional walk into a barGenerators provide lazy evaluation in Python, enabling iterable objects like range to create values on demand and avoid upfront computation.
PythonfromAntocuni15 years agoImproving Memory Behaviour to Make Self-Hosted PyPy Translations PracticalDeallocating unused JIT-generated loops via a loop_longevity policy dramatically reduces PyPy translation memory usage, enabling successful 32-bit compilations and lower RAM on 64-bit.