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 dtorp
Recipients alanmcintyre, dtorp, mark.dickinson, rhettinger
Date 2008-02-19.08:28:09
SpamBayes Score 0.13876913
Marked as misclassified No
Message-id <1203409690.92.0.503127845081.issue2138@psf.upfronthosting.co.za>
In-reply-to
Content
Mr. Dickinson thank you for doing this.  I do not know how to help with 
a patch.  If it helps, here is the code I use in python:

def factorial(n, _known=[1]):
    assert isinstance(n, int), "Need an integer. This isn't a gamma"
    assert n >= 0, "Sorry, can't factorilize a negative"
    assert n < 1000, "No way! That's too large"
    try:
        return _known[n]
    except IndexError:
        pass
    for i in range(len(_known), n+1):
        _known.append(_known[-1] * i)
    return _known[n]

When the assertions are turned-off, this runs pretty fast.
History
Date User Action Args
2008-02-19 08:28:11dtorpsetspambayes_score: 0.138769 -> 0.13876913
recipients: + dtorp, rhettinger, mark.dickinson, alanmcintyre
2008-02-19 08:28:10dtorpsetspambayes_score: 0.138769 -> 0.138769
messageid: <1203409690.92.0.503127845081.issue2138@psf.upfronthosting.co.za>
2008-02-19 08:28:10dtorplinkissue2138 messages
2008-02-19 08:28:09dtorpcreate