title: How to pick just one item from a generator?
body: <p>I have a generator function like the following:</p>
  
  <pre><code>def myfunct():
    ...
    yield result
  </code></pre>
  
  <p>The usual way to call this function would be:</p>
  
  <pre><code>for r in myfunct():
    dostuff(r)
  </code></pre>
  
  <p>My question, is there a way to get just one element from the generator whenever I like?
  For example, I'd like to do something like:</p>
  
  <pre><code>while True:
    ...
    if something:
        my_element = pick_just_one_element(myfunct())
        dostuff(my_element)
    ...
  </code></pre>