> Another puzzling thing is that
> b=[ ]
> %timeit b.extend([2])
> 1000000 loops, best of 3: 801 ns per loop
>
> type(b)
> <type 'list'>
>
> but then when I run
>
> %timeit b+[2]
> 10 loops, best of 3: 88.9 ms per loop
>
> That's much slower, in fact if you simple type b and hit enter... SAGE
> hangs.

This is because "%timeit b.extend([2])" changes b during each run.
Thus, after running timeit, b is a huge list.  Thus, when doing timing
b+[2], it has to make a copy of the huge list which takes time.

--Mike
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to