Search code examples
pythonc++decrement

equals sign after a decrement operator in C++ code


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


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