Re: [Tutor] Concatenating Strings

2012-05-29 Thread Steven D'Aprano
On Tue, May 29, 2012 at 03:51:21PM +1000, Steven D'Aprano wrote: Using + is arguably preferable when you have a choice to make, since it works in all cases, including constants. I'll argue differently: even though + works with string literals as well as variables, you shouldn't use it.

[Tutor] Concatenating Strings

2012-05-28 Thread Jeremy Duenas
I am trying to understand the point behind using the '+' character when trying to concatenate strings. I am new to learning Python and going through the book Python Programming for Absolute Beginners 3rd ed. and do not understand the point or reason for concatenating strings. The reason I do not

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Dave Angel
On 05/28/2012 10:00 PM, Jeremy Duenas wrote: I am trying to understand the point behind using the '+' character when trying to concatenate strings. I am new to learning Python and going through the book Python Programming for Absolute Beginners 3rd ed. and do not understand the point or

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Jeremy Duenas
. From: brian arb [mailto:brianjames...@gmail.com] Sent: Monday, May 28, 2012 7:22 PM To: Jeremy Duenas Cc: tutor@python.org Subject: Re: [Tutor] Concatenating Strings Your right that example from the book is a terrible example the point or the reason to concatenating strings. here

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Steven D'Aprano
On Mon, May 28, 2012 at 07:07:20PM -0700, Steve Willoughby wrote: On 28-May-12 19:00, Jeremy Duenas wrote: and the both printed the same output……so why would I want to use ‘+’ to add strings if there seems to be no reason too? Juxtaposing strings only works with constants, which may be

Re: [Tutor] Concatenating Strings

2012-05-28 Thread brian arb
Your right that example from the book is a terrible example the point or the reason to concatenating strings. here is a simple usage of where concatenating strings prints out a simple string as a counter in a loop. for i in range(5): ... print(str(i) + ' in for loop') ... 0 in for loop 1 in

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Steve Willoughby
On 28-May-12 19:00, Jeremy Duenas wrote: and the both printed the same output……so why would I want to use ‘+’ to add strings if there seems to be no reason too? Juxtaposing strings only works with constants, which may be convenient in some cases, but it won't work at all when concatenating