OT Signature quote [was Re: Unrecognized escape sequences in string literals]
darkwater42 at gmail.com
Sun Aug 16 05:00:23 CEST 2009
On Aug 15, 10:19 pm, Steven D'Aprano <st... at REMOVE-THIS-
> On Sat, 15 Aug 2009 13:01:43 -0700, Douglas Alan wrote:
> > P.S. I find it strange, however, that anyone who is not okay with
> > "abusing" operator overloading in this manner, wouldn't also take
> > umbrage at Python's overloading of "+" to work with strings and lists,
> > etc. Numerical addition and sequence concatenation have entirely
> > different semantics.
> Not to English speakers, where we frequently use 'add' to mean
> concatenate, append, insert, etc.:
That is certainly true, but the "+" symbol (pronounced "plus" not
"add") isn't exactly synonymous with the English word "add" and is
usually used in, technical circles, to refer to a function that at
least meets the properties of an abelian group operator.
Also, programming languages (other than Perl) should be more precise
than English. English words often have many, many meanings, but when
we are talking about types and operations on types, the operations
should generally have more specific semantics.
In any case, let's say we grant that operators should be allowed to be
as sloppy as English. Then we should have no problem with C++'s use of
"<<" for i/o. Pseudo-code has a long heritage of using "<-" to
indicate assignment, and there are a number of programming language
(e.g., APL) that use assignment to the output terminal to indicate
writing to the terminal. C++'s usage of "<<" for output is clearly
designed to be reminiscent of this, and therefore intuitive.
And intuitive it is, given the aforementioned background, at least.
So, as far as I can tell, Python has no real authority to throw stones
at C++ on this little tiny particular issue.
More information about the Python-list