how to get the ordinal number in list

Terry Reedy tjreedy at udel.edu
Mon Aug 11 18:01:25 EDT 2014


> On 11/08/2014 13:30, alister wrote:
>> It already is a different operator from equality which is ==

Mathematicians use '=' for name binding all the time, with and without 
'let':
   Let u = x + y, v = x - y. Then ... .
However, name binding itself is a mental operation, not a mathematical one.

Mathematicians sometimes differentiate conditionally true expressions 
from necessarily true expressions (tautologies, 'identically true') by 
using triple bars for the latter.  In algebra, (a+b)(a-b) <triple bar 
equal> a*a-b*b.  I think the sense of the extra bar is 'really equal, 
not just contingently equal).

Mathematicians sometimes use ':=' for definitions and sometimes decorate 
'=' in various other ways. Unicode has most of them. So mathematicians 
do not always use plain '=' for various ideas of sameness.

>> perhaps it would have been better if the behaviour of these two operators
>> were reversed (= for equality & == for assignment) but i suspect that
>> Idea if even considered was quickly discarded as it would cause major
>> confusion to programmers who work with multiple languages.

Given that assignment occurs more often than equality testing, it makes 
sense to use the shorter coding for assignment.  This principle operates 
in natural language (English at least) and in various codings from Morse 
to Huffman.

-- 
Terry Jan Reedy




More information about the Python-list mailing list