John Machin wrote:
> On Aug 17, 8:35 am, sturlamolden <sturlamol...@yahoo.no> wrote:
> 
>> A compiler could easily recognise a statement like
>>    for i in range(n):
>> as a simple integer loop. In fact, Cython is able to do this.
> 
> Extremely easy, once users relinquish the right to replace built-in
> "range" with their own concoctions ...

Cython allows you to do that. You just have to do it inside the module. If
Cython determines that "range" refers the global builtin name, it will
enable the loop optimisation. If you assign anything to that global name
inside your module (even the range function itself), this will disable the
optimisation.

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

Reply via email to