Author eric.smith
Recipients arjennienhuis, benjamin.peterson, christian.heimes, eric.smith, exarkun, ezio.melotti, glyph, gvanrossum, loewis, martin.panter, pitrou, serhiy.storchaka, terry.reedy, uau, vstinner
Date 2013-01-23.09:36:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1358933775.67.0.0763907415483.issue3982@psf.upfronthosting.co.za>
In-reply-to
Content
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().
History
Date User Action Args
2013-01-23 09:36:15eric.smithsetrecipients: + eric.smith, gvanrossum, loewis, terry.reedy, exarkun, pitrou, vstinner, christian.heimes, benjamin.peterson, glyph, ezio.melotti, arjennienhuis, uau, martin.panter, serhiy.storchaka
2013-01-23 09:36:15eric.smithsetmessageid: <1358933775.67.0.0763907415483.issue3982@psf.upfronthosting.co.za>
2013-01-23 09:36:15eric.smithlinkissue3982 messages
2013-01-23 09:36:15eric.smithcreate