Question

I have trying to translate code from C++ to python and on one line(in for loop), I have:

x -= (t = u/1.0+ MIN(c, EPS)) 

I want to know what the '=' sign after a decrement indicates? how can I translate this line in python

thank u

Was it helpful?

Solution

In c assigments are functions at there own, in Python assignments are expressions. In python this means

t = u/1.0 + min(c, EPS)
x -= t  # same as x = x - t
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top