On 06.03.2023 11:33, Steven D'Aprano wrote:
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.
I know, but as I mentioned, I use the above often, whereas I find Rob's
definition not very intuitive or useful.
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.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Experts (#1, Mar 06 2023)
>>> Python Projects, Coaching and Support ... https://www.egenix.com/
>>> Python Product Development ... https://consulting.egenix.com/
________________________________________________________________________
::: We implement business ideas - efficiently in both time and costs :::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
https://www.egenix.com/company/contact/
https://www.malemburg.com/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/E7DCRBG5I7RJPIHWSNDZPEBG7UVJEGMR/
Code of Conduct: http://python.org/psf/codeofconduct/