<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Declaring the *type* of such variables is a different matter I think (and probably is not considered 'pythonic'; certainly it's a crude, if effective, way of getting extra performance).</blockquote>

<div><br></div><div>I concur. Especially given performance is not a primary goal of Python to begin with, and--if such a bottleneck can be located--an extension module can be written to minimize it, anyway.</div><div><br>

</div>~/santa<br>
<br><br><div class="gmail_quote">On Fri, Mar 4, 2011 at 1:13 PM, BartC <span dir="ltr"><<a href="mailto:bc@freeuk.com">bc@freeuk.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
"Steven D'Aprano" <<a href="mailto:steve%2Bcomp.lang.python@pearwood.info" target="_blank">steve+comp.lang.python@pearwood.info</a>> wrote in message news:4d6f26a5$0$30003$c3e8da3$5496439d@news.astraweb.com...<div class="im">

<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone,<br>
<br>
Variables in Python are resolved dynamically at runtime, which comes at<br>
a performance cost. However, a lot of times we don't need that feature.<br>
Variables can be determined at compile time, which should boost up<br>
speed.<br>
</blockquote>
[...]<br>
<br>
This is a very promising approach taken by a number of projects.<br>
<br>
Cython and Pyrex are compilers that take Python-like code with static<br>
type declarations and use it to produce compiled C code.<br>
</blockquote>
<br></div>
I got the impression the OP was talking about simply pinning down certain variables, so that a runtime name lookup (if that's in fact what Python does) was not necessary.<br>
<br>
Declaring the *type* of such variables is a different matter I think (and probably is not considered 'pythonic'; certainly it's a crude, if effective, way of getting extra performance).<br>
<br>
-- <br><font color="#888888">
Bartc <br></font><div><div class="h5">
-- <br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br>