<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">On 03/20/2014 12:19 PM, Giuseppe Amato
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAEmjXoM8T3kzkNKkYRv6wHzLFsXAt53TMYDQuhptU=DPu_ZZkg@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">Il giorno 20 marzo 2014 12:15, Marco
          Beri <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:marcoberi@gmail.com" target="_blank">marcoberi@gmail.com</a>></span>
          ha scritto:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div class="gmail_extra">
                <div class="gmail_quote">2014-03-20 12:02 GMT+01:00
                  Giuseppe Amato <span dir="ltr"><<a
                      moz-do-not-send="true"
                      href="mailto:giuamato@gmail.com" target="_blank">giuamato@gmail.com</a>></span>:
                  <div class="">
                    <br>
                  </div>
                  <div>Io userei il modulo:</div>
                  <div><br>
                  </div>
                </div>
                <div class="gmail_extra">    var = (var + 1) % 3</div>
                <div class="gmail_extra"><br>
                </div>
                <div class="gmail_extra">Questo costrutto cicla tra 0,
                  1, 2.</div>
                <div class="">
                  <div class="gmail_extra"><br>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        Marco sei inestimabile! </div>
      <div class="gmail_extra">Qualcuno ha qualche risorsa dove posso
        trovare costrutti del genere? </div>
    </blockquote>
    <br>
    Potresti dare uno sguardo al modulo itertools [1] della libreria
    standard:<br>
    <br>
    >>> import itertools<br>
    >>> i = itertools.cycle(('pippo', 'franco', 3))<br>
    >>> next(i)<br>
    'pippo'<br>
    >>> next(i)<br>
    'franco'<br>
    >>> next(i)<br>
    3<br>
    >>> next(i)<br>
    'pippo'<br>
    <br>
    <br>
    [1] <a href="http://docs.python.org/3/library/itertools.html">http://docs.python.org/3/library/itertools.html</a><br>
    <pre class="moz-signature" cols="72">-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA) 
Phone: 070 711 80 217
Email: <a class="moz-txt-link-abbreviated" href="mailto:mbuttu@oa-cagliari.inaf.it">mbuttu@oa-cagliari.inaf.it</a></pre>
  </body>
</html>