문제

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

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top