title: yield break in Python
body: <p>According to answer to this <a href="https://stackoverflow.com/questions/1704607/difference-between-yield-in-python-and-yield-in-c">question</a>, <code>yield break</code> in C# is equivalent to <code>return</code> in Python. In the normal case, <code>return</code> indeed stops a generator. But if your function does nothing but <code>return</code>, you will get a <code>None</code> not an empty iterator, which is returned by <code>yield break</code> in C#</p>
  
  <pre><code>def generate_nothing():
      return
  
  for i in generate_nothing():
      print i
  </code></pre>
  
  <p>You will get a <code>TypeError: 'NoneType' object is not iterable</code>,
  but if I add and never run <code>yield</code> before <code>return</code>, this function returns what I expect.</p>
  
  <pre><code>def generate_nothing():
      if False: yield None
      return
  </code></pre>
  
  <p>It works, but seems weird. Do you have a better idea?</p>