having both dynamic and static variables

BartC bc at freeuk.com
Fri Mar 4 16:13:30 EST 2011


"Steven D'Aprano" <steve+comp.lang.python at pearwood.info> wrote in message 
news:4d6f26a5$0$30003$c3e8da3$5496439d at news.astraweb.com...
> On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote:
>
>> Hi everyone,
>>
>> Variables in Python are resolved dynamically at runtime, which comes at
>> a performance cost. However, a lot of times we don't need that feature.
>> Variables can be determined at compile time, which should boost up
>> speed.
> [...]
>
> This is a very promising approach taken by a number of projects.
>
> Cython and Pyrex are compilers that take Python-like code with static
> type declarations and use it to produce compiled C code.

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.

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).

-- 
Bartc 




More information about the Python-list mailing list