This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stutzbach
Recipients belopolsky, draghuram, mark.dickinson, rhettinger, stutzbach
Date 2010-05-13.21:13:33
SpamBayes Score 0.12988023
Marked as misclassified No
Message-id <1273785215.48.0.563755383228.issue8692@psf.upfronthosting.co.za>
In-reply-to
Content
Isn't it amazing how fast one can make incorrect code? ;-)

Here is a fixed version of my partial_product3, but now it is no faster than partial_product.

def partial_product3(j, i):
    a = [l << 1 | 1 for l in range(j, i + 1)]
    n = len(a)
    while 1:
        if n == 1:
            return a[0]
        half = n//2
        for k in range(0,half):
            a[k] = a[k*2] * a[k*2+1]
        if n & 1:
            a[half] = a[n-1]
            n = half + 1
        else:
            n = half
History
Date User Action Args
2010-05-13 21:13:35stutzbachsetrecipients: + stutzbach, rhettinger, mark.dickinson, belopolsky, draghuram
2010-05-13 21:13:35stutzbachsetmessageid: <1273785215.48.0.563755383228.issue8692@psf.upfronthosting.co.za>
2010-05-13 21:13:33stutzbachlinkissue8692 messages
2010-05-13 21:13:33stutzbachcreate