On Mon, Jun 2, 2008 at 8:54 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Lugwid appears correct:

I know he is - like I said in my reply to Ludwig, I picked a bad
example. My point was that slicing doesn't _always_  produce a copy -
it depends on the optimizations available to the bytecode compiler. By
way of demonstration:

d = [1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]
for i in range(1,10000000):
    s = 0
    sub = d[5:10]
    for v in sub:
        s = s + v

takes 25 seconds to execute, but

for i in range(1,10000000):
    s = 0
    for v in d[5:10]:
        s = s + v

takes 19 seconds.

Yours
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to