3 ms·
return ''.join(`num` for num in xrange(loop_count)) is better than return ''.join([`num` for num in xrange(loop_count)])
by c00w 15y ago
return ''.join(`num` for num in xrange(loop_count))
is better than
return ''.join([`num` for num in xrange(loop_count)])
- rabidsnail 15y agoThe latter will allocate all of the integers and then free them as they're joined. The former will allocate one integer, then add it to the string and free it, then allocate another integer.