[Python-ideas] Implicit String Concatenation

Adam Atlas adam at atlas.st
Thu Apr 19 01:01:10 CEST 2007


On 18 Apr 2007, at 18.43, Jan Claeys wrote:
> Op zaterdag 14-04-2007 om 23:07 uur [tijdzone -0400], schreef Adam
> Atlas:
>> On 14 Apr 2007, at 22.46, Jan Claeys wrote:
>>> D uses '~' as a string concatenation operator...
>>
>> Eh... I like D, but that would be confusing in Python, since it
>> already uses ~ as a unary operator that means something totally
>> different.
>
> Python uses '+', '*', ':', '.', etc. for multiple different purposes
> already, and at least the '+' case is more confusing sometimes than  
> '~'
> would ever be...

Heh, yeah, I actually realized immediately after I sent that email  
that the exact same thing could be said about +. But I don't know...  
even if + might be confused with an arithmetic operator sometimes,  
it's what people are used to, and I think it makes sense intuitively.  
'Plus', in a very abstract sense, suggests 'put two things together',  
whether with numbers or strings or anything else for which we have a  
concept of 'putting together'. ~ doesn't have that advantage. If a  
programmer coming from pretty much any language sees "foo"+"bar",  
they're probably going to be able to guess that it's concatenations.  
If they see "foo"~"bar", it is really not immediately clear what it's  
doing.



More information about the Python-ideas mailing list