4 ms·
Yes but it's still a loop in Python, which means it calls iter() then __next__() in a try/except to catch StopIteration in the end. It's a lot of overhead. tos
by sametmax 10y ago
Yes but it's still a loop in Python, which means it calls iter() then __next__() in a try/except to catch StopIteration in the end. It's a lot of overhead.
tostring() or encode() will do an implicity loop in C, which will be much faster.