Time we switched to unicode? (was Explanation of this Python language feature?)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Mar 25 12:14:53 CET 2014

On Tue, 25 Mar 2014 11:38:38 +0100, Antoon Pardon wrote:

> On 25-03-14 10:54, Chris Angelico wrote:
>> On Tue, Mar 25, 2014 at 8:43 PM, Antoon Pardon
>> <antoon.pardon at rece.vub.ac.be> wrote:
>>> I thought programs were read more than written. So if writing is made
>>> a bit more problematic but the result is more readable because we are
>>> able to use symbols that are already familiar from other contexts, I
>>> would say it is worth it.
>> It's a matter of extents. If code is read ten times for every time it's
>> written, making it twenty times harder to write and a little bit easier
>> to read is still a bad tradeoff.
>> Also: To what extent IS that symbol familiar from some other context?
>> Are you using Python as a programming language, or should you perhaps
>> be using a mathematical front-end? Not everything needs to perfectly
>> match what anyone from any other context will expect. This is, first
>> and foremost, a *programming* language.
> So? We do use + -, so why shouldn't we use × for multiplication. 

I can't find × on my keyboard!

I tried using x instead, but I got a syntax error:

py> 2x3
  File "<stdin>", line 1
SyntaxError: invalid syntax

> Would
> such a use already indicate I should use a mathematical front-end?
> When a programming language is borrowing concepts from mathematics, I
> see no reason not to borrow the symbols used too.

I'd like to sum the squares of the integers from n=1 to 10. In the old 
Python, I'd write sum(n**2 for n in range(1, 11)), but with the brave new 
world of maths symbols, I'd like to write this:


How do I enter that, and what text editor should I use?

Steven D'Aprano

More information about the Python-list mailing list