In JavaScript and Python /=, this is an extended-purpose statement that has almost the same meaning.
In JS:
var i = 10;
i /= 2;
... is equivalent to:
var i = 10;
i = i / 2;
And, in Python:
i = 10
i /= 2
... is also equivalent (not exactly the same, but close enough for numbers):
i = 10
i = i / 2
However, there is one very big difference.
In JavaScript, assignment is an expression - it has a value, and this value is the value assigned to the variable. So:
var i = 10;
var j = i /= 2;
... roughly equivalent to:
var i = 10;
i /= 2;
var j = i;
Python - . . :
i = 10
j = i /= 2
... a SyntaxError.
, ( ) , / , - . ( , ...)
, JS ( , ?):
def easeInQuad(x, t, b, c, d):
t /= d
return c*t*t+b
:
old_t = t
t /= d
t t/=d old_t t/=d . , , old_t.
, , t , , :
return c * (t/d) * (t/d) + b
return c * (t/d)**2 + b
return c * t*t / d*d + b
-, C, , " ". , , - , . !
, :
t_over_d = t/d
return c * t_over_d * t_over_d + b
... , C, , . , , , , 1985, , t , t_over_d , , , ?
JS Python , -, , . ( JIT V8 PyPy) , .
, , "" , , , , , , , .
, JavaScript ...
-, JavaScript ", Firefox" ( " Spidermonkey", ), , JavaScript 2 , , ?). ECMAScript , , JS ( ) , , ECMAScript 5.1 , ( , "" "). .
, ES 5.1: 11.5 , (t/=d) t, 11.13.2 , t/=d t . ( , "", GetValue a SetValue, , .)