Imo `&` is not a suitable replacement for `+`.
Semantically when I read "Tony & Maria" it looks closer to behaving like a
Set.union ala`{"Tony"}.union({"Maria"})`
where comparatively the addition (+) infix operator is there to facilitate
concatenation, which is a very common operation and does not behave like
Set.union.
> Examples:
> x = ("I love")
> y = ("this idea ")
> z = ("posted on November ")
> a = 18
> print (x & y & z & a) # prints I love this idea posted on November 18
Quoting the zen of Python here:
> Explicit is better than implicit.
I dont think Python should start allowing implicit type casting on select
operators for builtins at the risk of subtle gotchas for the newer programmers.
> print (x + y + z + str(a))
> and thats not much difference to worry about. Problem comes when there are
> more different
> data types need to be added and combined together.
> This would make things allot easier for many people and make string handling
> easier
> also.
The popular solution for this is explicitly formatting a string:
`f"{x}{y}{z}{a}"`
or for the more functional programmers out there folding a map
`"".join(map(str, (x, y, z, a))`
_______________________________________________
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/5WV6DC2W6LIU7YIXPITVYG6MLEZCP6PX/
Code of Conduct: http://python.org/psf/codeofconduct/