invitro81 wrote:
> Which one is better w.r.t. memory allocation but also w.r.t. speed:
> ## 1.1 ##
> def forloop(a,b):
> for idx in range(a,b):
> ...
Above preferred to next (for readability) using xrange may help speed
depending.
> ## 1.2 ##
> def whileloop(a,b):
> idx = a
>
> I mean what I really would like is to have something C++ - like "for
> (int idx = a; idx < b; i++) { .. }" where no internal vector or
> something like that is allocated but only a few op's on registers are
> performed; in the whileloop in python the picture is roughly the same
Use xrange i