title: there's no next() function in a yield generator in python 3
body: <p>In <a href="https://stackoverflow.com/questions/12262184/how-to-make-a-iterable-object-like-this">this question</a>, I have an endless sequence using Python generators. But the same code doesn't work in Python 3 because it seems there is no <code>next()</code> function. What is the equivalent for the <code>next</code> function?</p>
  
  <pre><code>def updown(n):
      while True:
          for i in range(n):
              yield i
          for i in range(n - 2, 0, -1):
              yield i
  
  uptofive = updown(6)
  for i in range(20):
      print(uptofive.next())
  </code></pre>