Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of the <- symbol in Python

Tags:

python

I am reading a Python book that uses the symbol

<-

It seems to be used interchangeably with the = sign. Is this a normal symbol to explain this? I have never seen it used elsewhere. enter image description here

like image 258
CoderJK Avatar asked Jul 18 '15 19:07

CoderJK


3 Answers

It's not a symbol, it's simply showing that when you make an assignment using '=' you are placing the value on the right into the variable on the left.

like image 89
Ajaypayne Avatar answered Oct 09 '22 01:10

Ajaypayne


a <- b (better formatted as a < -b) means "a less than minus b" , so

>>> a = -5
>>> b = 3
>>> a <- b
True

>>> a = 3
>>> b = 4
>>> a <- b
False

In your image, as others have pointed out, the author is just indicating an assignment, it's unfortunate that the typography made it look like code, it wasn't meant to be a "less than minus". 😊

like image 40
Roshan Mathews Avatar answered Oct 09 '22 01:10

Roshan Mathews


It's just a pseudo-code example, not Python syntax.

like image 4
DeepSpace Avatar answered Oct 09 '22 00:10

DeepSpace