[Python-Dev] Eliminating loops

Brett Cannon brett at python.org
Sat Jul 29 03:40:43 CEST 2006


On 7/28/06, Charles Vaughn <cvaughn at gmail.com> wrote:
>
> I'm looking for a way of modifying the compiler to eliminate any loops and
> recursion from code.  It's for a high speed data processing application.
> The alternative is a custom language that is little more than gloryfied
> assembly.  I'd like to be able to use everything else around Python, but we
> can't allow the users to create more than O(1) complexity.
>

Well, the problem is how are you going to infer how many times to unroll the
loop?  range() and xrange() can change since they are only built-ins.  You
would need type inference on some locally defined variable that was set to a
syntactically defined atomic type in order to know the proper number of
times to unroll the loop and that might not work for your needs (on top of
being a pain to write out a list with however many values you want to have
the loop iterate over).

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060728/ed111499/attachment-0001.htm 


More information about the Python-Dev mailing list