[Python-ideas] Python 4: Concatenation
Steven D'Aprano
steve at pearwood.info
Fri Jun 30 08:43:34 EDT 2017
On Fri, Jun 30, 2017 at 12:51:26PM +0100, Jamie Willis wrote:
> Just as an aside, if a concatenation operator *was* included, a suitable
> operator would be "++",
As mentioned earlier in this thread, that is not possible in Python as
syntactically `x ++ y` would be parsed as `x + (+y)` (the plus binary
operator followed by the plus unary operator).
> this is the concatenation operator in languages
> like Haskell (for strings) and the majority of Scala cases. Alternatively
> "<>" is an alternative, being the monoidal append operator in Haskell,
> which retains a certain similarly.
"<>" is familiar to many people as "not equal" in various programming
languages, including older versions of Python. I'm not entirely sure
what connection "<>" has to append, it seems pretty arbitrary to me,
although in fairness nearly all operators are arbitrary symbols if you
go back far enough.
--
Steve
More information about the Python-ideas
mailing list