Top "Yield" questions

yield is (1) a keyword that facilitates creation of generator functions, (2) a Ruby statement to transfer control from one coroutine to another, (3) a Java statement used to yield a value from a switch expression.

yield in list comprehensions and generator expressions

The following behaviour seems rather counterintuitive to me (Python 3.4): >>> [(yield i) for i in range(3)] <generator …

python generator list-comprehension yield generator-expression
C#: yield return range/collection

I use the yield return keyword quite a bit, but I find it lacking when I want to add a …

c# .net yield
check if function is a generator

I played with generators in Nodejs v0.11.2 and I'm wondering how I can check that argument to my function is …

javascript generator yield ecmascript-6
What is the simplest way to create an empty iterable using yield in Python?

I was playing around with iterables and more specifically the yield operator in Python. While using test driven development to …

python iterator yield
How to write Python generator function that never yields anything

I want to write a Python generator function that never actually yields anything. Basically it's a "do-nothing" drop-in that can …

python generator yield
Loop over two generator together

I have two generators say A() and B(). I want to iterate over both the generators together. Something like: for …

python loops for-loop generator yield
implementing a state machine using the "yield" keyword

Is it feasible to use the yield keyword to implement a simple state machine as shown here. To me it …

c# yield state-machine fsm
Python asyncio, futures and yield from

Consider the following program (running on CPython 3.4.0b1): import math import asyncio from asyncio import coroutine @coroutine def fast_sqrt(…

python future yield coroutine python-asyncio
Javascript check yield support

I read about the yield keyword in JavaScript and I need to use it in my project. I read that …

javascript keyword yield yield-keyword
Why use the yield keyword, when I could just use an ordinary IEnumerable?

Given this code: IEnumerable<object> FilteredList() { foreach( object item in FullList ) { if( IsItemInPartialList( item ) ) yield return item; } } Why …

c# yield