title: How to fix this iterator?
body: <p>I'm trying to write an iterator Digits(n) that generates digits of a natural number n in reverse order. Here's my code so far:</p>
  
  <pre><code>class Digits:
  
      def __init__(self, n):
          self.n = n
  
      def __iter__(self):
          return self
  
      def __next__(self):
          if self.n &lt; 10:
              return self.n
          return self.n // 10
  </code></pre>
  
  <p>Output should be:</p>
  
  <pre><code>&gt;&gt;&gt; print([x for x in Digits(1337)])
  [7, 3, 3, 1]
  </code></pre>
  
  <p>I feel I should implement somewhere <code>self.n % 10</code> (I hope) , but I don't know where. Any suggestions?</p>