sequence multiplied by -1

Steven D'Aprano steve at
Sun Oct 3 05:08:14 CEST 2010

On Sat, 02 Oct 2010 12:50:02 -0700, Dennis Lee Bieber wrote:

> 	Well... We could maybe borrow from REXX... and 
> use		||	for concatenation.

|| for concatenation? What's the connection between the pipe character 
and concatenation? I realise that, ultimately, every symbol was just made 
up, but at this point in history the pipe character has the established 
meaning of being used for binary- and bitwise-or, as well as the piping 
of results from one command to another in shell scripts. Where's the 
connection between those uses and concatenation? Why choose || instead of 
^^ or && or |& or any other arbitrary combination of symbols? It seems to 
me that || was just plucked out of the air because it was unused.

Both the + and & symbols have extremely strong associations with three 
related operations (concatenate, add, and). They are related: integer 
addition is a generalisation of concatenation, and you perform addition 
by concatenation in unary (tally) notation.

Function names should be meaningful. You wouldn't write a function qq() 
just because the name qq happened to be unused. And neither should you 
use an operator unless the symbol is meaningful for the application.

Once you swallow the artificial and harmful convention that no operator 
may ever be used twice, you're left with either avoiding operators even 
when they would be useful, or choosing them arbitrarily. Both are harmful.


More information about the Python-list mailing list