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

Était-ce utile?

La 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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top