And now for something completely different. Was: String.join revisited (URGENT for 1.6)

James Logajan JamesL at Lugoj.Com
Tue May 30 23:40:00 EDT 2000


Johannes Stezenbach wrote:
> In my very humble opinion
>   words = ["foo", "bar", "baz"]
>   print words.join(" ")
> looks right and
>   print " ".join(words)
> looks wrong. It will confuse people and provoke programming errors.

Speaking of interesting syntax, did you know the following is perfectly
valid C/C++:

var = 2["abc"];

Points awarded for determining the type of "var" and the value assigned to
it. Extra credit points for explaining why this is valid C/C++. (Hint: this
has been valid C for as long as the language has been around.)


P.S. I find the syntax

" ".join(words)

natural and somewhat pleasing. And no, I have no strange desire to see a
Scotsman on a horse. Why do you ask?



More information about the Python-list mailing list