Time we switched to unicode? (was Explanation of this Python language feature?)
antoon.pardon at rece.vub.ac.be
Tue Mar 25 12:46:14 CET 2014
On 25-03-14 12:14, Steven D'Aprano wrote:
> 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!
Then use an editor that allows you to configure it, so you can
easily use it.
That's the kind of advice that is often enough given here if
some python feature is hard for the tools someone is using.
So why should it be different now?
>> 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?
You have a point. Blindly following mathematical notation will not
work, because mathematics often enough uses positional clues that
will be very hard to incorparate in a programming language.
But often enough languages tried to use the symbols that were
available to them. Now that more are, I see little reason for
avoiding there use.
More information about the Python-list