Re: [Tutor] working with strings in python3

2011-04-18 Thread Westley Martínez
On Tue, 2011-04-19 at 02:16 +, Steven D'Aprano wrote: > On Tue, 19 Apr 2011 10:34:27 +1000, James Mills wrote: > > > Normally it's considered bad practise to concatenate strings. > > *Repeatedly*. > > There's nothing wrong with concatenating (say) two or three strings. > What's a bad idea

Re: [Tutor] working with strings in python3

2011-04-18 Thread Chris Angelico
On Tue, Apr 19, 2011 at 12:16 PM, Steven D'Aprano wrote: > See Joel on Software for more: > > http://www.joelonsoftware.com/articles/fog000319.html The bulk of that article is reasonable; he's right in that a good programmer MUST have at least some understanding of what's happening on the low

Re: [Tutor] working with strings in python3

2011-04-18 Thread Dan Stromberg
On Mon, Apr 18, 2011 at 6:23 PM, Benjamin Kaplan wrote: > On Mon, Apr 18, 2011 at 8:58 PM, Westley Martínez wrote: >> On Tue, 2011-04-19 at 10:34 +1000, James Mills wrote: >>> On Tue, Apr 19, 2011 at 10:17 AM, Rance Hall wrote: >>> > pseudo code: >>> > >>> > >>> > message = "Bah." >>> > >>> > if

Re: [Tutor] working with strings in python3

2011-04-18 Thread Steven D'Aprano
On Tue, 19 Apr 2011 10:34:27 +1000, James Mills wrote: > Normally it's considered bad practise to concatenate strings. *Repeatedly*. There's nothing wrong with concatenating (say) two or three strings. What's a bad idea is something like: s = '' while condition: s += "append stuff to end

Re: [Tutor] working with strings in python3

2011-04-18 Thread Westley Martínez
On Mon, 2011-04-18 at 21:23 -0400, Benjamin Kaplan wrote: > message = "%s %s" % (message, " Humbug!") fix'd -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] working with strings in python3

2011-04-18 Thread Benjamin Kaplan
On Mon, Apr 18, 2011 at 8:58 PM, Westley Martínez wrote: > On Tue, 2011-04-19 at 10:34 +1000, James Mills wrote: >> On Tue, Apr 19, 2011 at 10:17 AM, Rance Hall wrote: >> > pseudo code: >> > >> > >> > message = "Bah." >> > >> > if test: >> >   message = message + " Humbug!" >> > >> > print(messag

Re: [Tutor] working with strings in python3

2011-04-18 Thread Westley Martínez
On Tue, 2011-04-19 at 10:34 +1000, James Mills wrote: > On Tue, Apr 19, 2011 at 10:17 AM, Rance Hall wrote: > > pseudo code: > > > > > > message = "Bah." > > > > if test: > > message = message + " Humbug!" > > > > print(message) > > > > end pseudo code > > Normally it's considered bad practise

Re: [Tutor] working with strings in python3

2011-04-18 Thread James Mills
On Tue, Apr 19, 2011 at 10:17 AM, Rance Hall wrote: > pseudo code: > > > message = "Bah." > > if test: >   message = message + " Humbug!" > > print(message) > > end pseudo code Normally it's considered bad practise to concatenate strings. Use a a format specifier like this: > message = "Bah." >