<div class="gmail_quote">2011/7/4 Marco Mariani <span dir="ltr"><<a href="mailto:birbag@gmail.com">birbag@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im"><br>2011/7/4 Fabrizio Mancini <span dir="ltr"><<a href="mailto:mr.file@gmail.com" target="_blank">mr.file@gmail.com</a>></span><br> </div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div class="gmail_quote"><div> non ho ancora mai toccato p3, ma funziona anche con la 2.6.7 o solo >=2.7?<br></div></div></blockquote></div><div><br>Si', c'e' gia' e consiglio di provarlo.<br>Con la 2.7 hannno aggiunto i {} senza numero e altre cose della 3.2<br>
</div></div></blockquote><div><br></div><div>Il solito nitpicker mi fa notare che l'operatore % non è stato deprecato nella 3.</div><div>Vero.</div><div><br></div><div>Però da <a href="http://docs.python.org/py3k/library/stdtypes.html#index-22">http://docs.python.org/py3k/library/stdtypes.html#index-22</a> :</div>
</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><span class="Apple-style-span" style="font-family: sans-serif; font-size: 16px; line-height: 20px; ">The formatting operations described here are obsolete and may go away in future versions of Python. Use the new <a class="reference internal" href="http://docs.python.org/py3k/library/string.html#string-formatting" style="color: rgb(53, 95, 124); text-decoration: none; "><em>String Formatting</em></a> in new code.</span></div>
</div></blockquote><div class="gmail_quote"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Inoltre l'operatore % causa dei comportamenti carini come in questo caso (visto a un talk di Hettinger a Europython):</div>
<div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "%d" % 3 * 3</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">'333'</font></div></div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "%d" % 3 ** 3</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">'27'</font></div></div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "%d" % 3 % 3</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">Traceback (most recent call last):</font></div></div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace"> File "<stdin>", line 1, in <module></font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">TypeError: not all arguments converted during string formatting</font></div></div></div></blockquote><div class="gmail_quote">
<div><div><br></div></div><div>Mentre:</div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "{0}".format(3 * 3)</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">'9'</font></div></div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "{0}".format(3 ** 3)</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">'27'</font></div></div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">>>> "{0}".format(3 % 3)</font></div>
</div></div><div class="gmail_quote"><div><div><font class="Apple-style-span" face="'courier new', monospace">'0'</font></div></div></div></blockquote><div class="gmail_quote"><div><div><br></div></div><div>
Ciao.<br>Marco.</div><div><br></div></div>-- <br><div><div><div><div><a href="http://beri.it/i-miei-libri/" target="_blank">http://beri.it/i-miei-libri/</a> - Qualche libro...</div><div><a href="http://stacktrace.it/" target="_blank">http://stacktrace.it</a> - Aperiodico di resistenza informatica</div>
<div><a href="http://thinkcode.tv/gratis" target="_blank">http://thinkcode.tv/gratis</a> - Capire in 15 minuti cosa può fare Python</div></div></div></div><br>