Michele <[EMAIL PROTECTED]> writes:

> Hi there,
> I'm relative new to Python and I discovered that there's one single way
> to cycle over an integer variable with for:
> for i in range(0,10,1)

Please use xrange for this purpose, especially with larger
iterations.  range actually allocates a sequence.

> However, how this C statement will be translated in Python?
>
> for (j = i = 0; i < (1 << H); i++)

If H doesn't change during the loop, you can use:

j = 0
for i in xrange(1 << H):
    ...

If H can change, simply rewrite it into an obvious 'while' loop.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to