Hi! On 28 Nov., 10:30, Simon King <simon.k...@nuigalway.ie> wrote: > One question: Is my impression right that list(csv.reader([s]))[0] is > often faster than s.split(',')? Or is it a stupid idea to not use split > (',') for that purpose?
Apparently not, although I remember that I did some tests in which csv was faster. So, I'd appreciate some advice when to use split() and when to use csv! sage: L=[str(i) for i in range(10000)] sage: s=','.join(L) sage: import csv sage: s.split(',')==list(csv.reader([s]))[0] True sage: timeit("s.split(',')") 625 loops, best of 3: 438 µs per loop sage: timeit("list(csv.reader([s]))[0]") 625 loops, best of 3: 788 µs per loop Cheers, Simon -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org