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

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 9:41:53 AM UTC+2, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's

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

2014-02-08 Thread Rustom Mody
On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's

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

2014-02-08 Thread Peter Otten
cstrutto...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has given me a few ideas. Each has its pro's and cons. The best I have come up with is:

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

2014-02-08 Thread cstrutton11
On Saturday, February 8, 2014 3:35:34 AM UTC-5, Rustom Mody wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in

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

2014-02-08 Thread cstrutton11
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. I get what your saying

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

2014-02-08 Thread cstrutton11
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

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

2014-02-08 Thread Steven D'Aprano
On Sat, 08 Feb 2014 01:56:46 -0800, cstrutton11 wrote: 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

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

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 11:56:46 AM UTC+2, cstru...@gmail.com wrote: 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

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

2014-02-08 Thread Roy Smith
In article 3157d511-48d1-4e4d-be4c-2c461fc17...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are

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

2014-02-08 Thread Rustom Mody
On Saturday, February 8, 2014 4:58:03 PM UTC+5:30, Asaf Las wrote: Check this approach if it suits you: str_t= 'script type=text/javascript' \ 'src=/{0}/jquery/jqueryui.js/script' \ 'script type=text/javascript'\ 'src=/{1}/jquery/jquery.js/script'.format('bella', 'donna')

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

2014-02-08 Thread Mark Lawrence
On 08/02/2014 10:11, cstrutto...@gmail.com wrote: 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

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

2014-02-08 Thread Dave Angel
cstrutto...@gmail.com Wrote in message: I didn't realize I could use formatting with triple quoted strings. I will look into that. You probably realize this, but formatting does not work on literals of any kind. It works on str objects, which can be created by any kind of literal,

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

2014-02-08 Thread Eric S. Johansson
On 2/8/2014 3:35 AM, Rustom Mody wrote: On Saturday, February 8, 2014 1:11:53 PM UTC+5:30, cstru...@gmail.com wrote: I am writing a couple of class methods to build up several lines of html. Some of the lines are conditional and most need variables inserted in them. Searching the web has