<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">To the people who kindly replied to my
      question: many thanks!<br>
      <br>
      <br>
      On 10/31/2013 06:29 PM, Danny Yoo wrote:<br>
    </div>
    <blockquote
cite="mid:CAGZAPF77G7F0kgbW0Y9qHxEyTv-k6aoU_QJmPXEbBr=ifFMUuw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>As an aside: It shouldn't be too bad to write a "generator"
          for the geometric series, so that we can pick out the terms
          on-demand.</div>
        <div><br>
        </div>
        <div>
          <div>#################################</div>
        </div>
        <div>>>> def geometric(base):</div>
        <div>...     x = 1</div>
        <div>...     while True:</div>
        <div>...         yield x</div>
        <div>...         x *= base</div>
        <div>... </div>
        <div>>>> twos = geometric(2)<br>
        </div>
        <div>#################################</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>'twos' is a representation of the geometric series; we can
          then pick out the elements one at a time:</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>
          <div>#################################</div>
        </div>
        <div>>>> twos.next()<br>
        </div>
        <div>1</div>
        <div>>>> twos.next()</div>
        <div>2</div>
        <div>>>> twos.next()</div>
        <div>4</div>
        <div>>>> twos.next()</div>
        <div>8</div>
        <div>>>> twos.next()</div>
        <div>16</div>
        <div>>>> twos.next()</div>
        <div>32</div>
        <div>>>> twos.next()</div>
        <div>64</div>
        <div>
          <div>#################################</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
To unsubscribe or change subscription options:
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/tutor">https://mail.python.org/mailman/listinfo/tutor</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>