[Python-ideas] Is there a good reason to use * for multiplication?
steve at pearwood.info
Sat Oct 13 04:41:18 CEST 2012
On 13/10/12 07:27, Ram Rachum wrote:
> Hi everybody,
> Today a funny thought occurred to me. Ever since I've learned to program
> when I was a child, I've taken for granted that when programming, the sign
> used for multiplication is *. But now that I think about it, why? Now that
> we have Unicode, why not use · ?
25 or so years ago, I used to do some programming in Apple's Hypertalk
language, which accepted ÷ in place of / for division. The use of two
symbols for the same operation didn't cause any problem for users. But then
Apple had the advantage that there was a single, system-wide, highly
discoverable way of typing non-ASCII characters at the keyboard, and Apple
users tended to pride themselves for using them.
I'm not entirely sure about MIDDLE DOT though: especially in small font sizes,
it falls foul of the design principle:
"syntax should not look like a speck of dust on Tim's monitor"
(paraphrasing... can anyone locate the original quote?)
and may be too easily confused with FULL STOP. Another problem is that MIDDLE
DOT is currently valid in identifiers, so that a·b would count as a single
name. Fixing this would require some fairly heavy lifting (a period of
deprecation and warnings for any identifier using MIDDLE DOT) before
introducing it as an operator. So that's a lot of effort for very little gain.
If I were designing a language from scratch today, with full Unicode support
from the beginning, I would support a rich set of operators possibly even
including MIDDLE DOT and × MULTIPLICATION SIGN, and leave it up to the user
to use them wisely or not at all. But I don't think it would be appropriate
for Python to add them, at least not before Python 4: too much effort for too
little gain. Maybe in another ten years people will be less resistant to
> ·. People on Linux can type Alt-. .
For what it is worth, I'm using Linux and that does not work for me. I am
yet to find a decent method of entering non-ASCII characters.
More information about the Python-ideas