Another question

Tim Peters tim_one at email.msn.com
Tue Apr 18 08:43:14 CEST 2000


[Michael Hudson]
> ...
> For that last dreg of performance you might try:
>
> import random
> def do_it(randint=random.randint,xrange=xrange):
>     r = [0,] * 100000
>     for i in xrange(100000):
>        r[i] = randint(1,10)
> do_it()

Or even make the guts:

    r = range(100000)
    for i in r:
        r[i] = randint(1, 10)

> But really, this is getting silly; if performance is this much of an
> obsession you aren't going to have that much fun with Python.

To the contrary, speeding a language that fights you each step of the way is
rather akin to seduction -- what could be more fun than that <wink>?

python-is-the-language-of-lovers-ly y'rs  - tim






More information about the Python-list mailing list