Documentation, assignment in expression.

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Mar 26 01:47:36 EDT 2012


On Sun, 25 Mar 2012 17:16:16 +0200, Kiuhnm wrote:

> On 3/25/2012 15:48, Tim Chase wrote:
>> The old curmudgeon in me likes the Pascal method of using "=" for
>> equality-testing, and ":=" for assignment which feels a little closer
>> to mathematical use of "=".
> 
> Unfortunately, ":=" means "is defined as" in mathematics. The "right"
> operator would have been "<-".

That's hardly universal. In approx 20 years of working with mathematics 
textbooks, I've never seen := used until today.

I see that Wikipedia lists no fewer than seven different symbols for "is 
defined as":

http://en.wikipedia.org/wiki/Table_of_mathematical_symbols

including the one I'm familiar with, ≝, or "def" over "=".  

Besides, just because mathematicians use a symbol, doesn't mean 
programming languages can't use it for something else.



-- 
Steven



More information about the Python-list mailing list