What is the most pythonic way to build up large strings?

cstrutton11 at gmail.com cstrutton11 at gmail.com
Sat Feb 8 05:11:55 EST 2014


On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote:

> 
> note, due to strings are immutable - for every line in sum operation 
> 
> above you produce new object and throw out older one. you can write 
> 
> one string spanned at multiple lines in very clear form. 
> 
> /Asaf

I think I going to rewrite this to build up a list of strings and then run a join on them at the end.  Each section can be conditionally built up with variable insertions as required.  This should be more efficient and will scale nicely as required.



More information about the Python-list mailing list