bitwise shift?
Thomas Krüger
see_signature at nospam.nowire.org
Wed Apr 25 17:05:42 EDT 2007
desktop schrieb:
> I have found a code example with this loop.
>
> for k in range(10, 25):
> n = 1 << k;
>
>
> I have never read Python before but is it correct that 1 get multiplied
> with the numbers 10,11,12,12,...,25 assuming that 1 << k means "1 shift
> left by k" which is the same as multiplying with k.
1 << n
is a more efficient replacement for
2**n
Thomas
--
sinature: http://nospam.nowire.org/signature_usenet.png
More information about the Python-list
mailing list