On Wed, 11 Aug 2010 06:09:28 am Joel Goldstick wrote: > The str part of str.join() is the string where the result is stored, > so you can start off with an empty string: ""
I don't understand what you mean by that. I can only imagine you think that the string part is a fixed-width buffer that has the result stored into it, but of course that's ridiculous because that's nothing like what join does. Python strings are immutable so you can't store something inside an existing string, but even if they weren't, since the result of join is usually larger than the initial string you pass, what would be the point? The string part of str.join is the string which is used to join the rest of the arguments. This: "spam".join([ "a", "b", "c" ]) is equivalent to: "a" + "spam" + "b" + "spam" + "c" except more efficient and faster. The result is stored in a new string. -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor