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 gi

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 litera

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 v

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= '' \ > ''.format('bella', 'donna') > print(str_t) Many people prefer this >>> str_t= ( '' ... '' ... ) >>> str_t '' Which is to say use the fact that adjacent strin

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 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 nee

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 on

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

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

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 s

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

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 i

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'

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'

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

2014-02-07 Thread cstrutton11
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: def output_header_js(self, jquery=T