On Mon, Mar 06, 2023 at 10:33:26AM +0100, Marc-Andre Lemburg wrote:
> def join_words(list_of_words)
> return ' '.join([x.strip() for x in list_of_words])
That's not Rob's suggestion either.
Rob's suggestion is an operator which concats two substrings with
exactly one space between them, without stripping leading or trailing
whitespace of the result.
Examples:
a = "\nHeading:"
b = "Result\n\n"
a & b
would give "\nHeading: Result\n\n"
s = " my hovercraft\n"
t = " is full of eels\n"
s & t
would give " my hovercraft is full of eels\n"
I find the concept is very easy to understand: "concat with exactly one
space between the operands". But I must admit I'm struggling to think
of cases where I would use it.
I like the look of the & operator for concatenation, so I want to like
this proposal. But I think I will need to see real world code to
understand when it would be useful.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/2OZXSXETHQLWJQYAM2S3SJVACPEIPDSZ/
Code of Conduct: http://python.org/psf/codeofconduct/