"Diez B. Roggisch" wrote:

>> There is another secondary advantage: the code inside a function runs
>> faster (something related is true for C programs too). Usually this
>> isn't important, but for certain programs they can go 20%+ faster.
>
> I totally fail to see why that should be the case - for python as well as
> for C.
>
> So - can you explain that a bit more, or provide resources to read up on it?

Python stores local variables in an indexed array, but globals in a dictionary.
Looking things up by index is faster than looking them up by name.

Not sure what the C thing is; C doesn't really support putting *code* outside
functions.  Maybe he was thinking about static vs. auto variables ?

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to