Eric V. Smith added the comment: I think ''.join() will always be faster than ''.format(), for a number of reasons (some already stated): - it doesn't have to pass the format string - it doesn't have to do the __format__ lookup and call the resulting function (although I believe there's an optimization for str) - it doesn't have to consider the conversion and formatting steps
Whether b''.format() would have to lookup and call __format__ remains to be seen. From what I've read, maybe baking in knowledge of bytes, float, and int would be good enough. I suspect there might be some need for datetimes, but I could be wrong. The above said, code using b''.format() would definitely be easier to write and understand that a lot of individual field formatting followed by a .join(). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3982> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com