4 ms·
Are you referring to this line where he initializes 4 variables? bounds, s, t, j = (0,0), -float('infinity'), 0, 0
by brent 18y ago
Are you referring to this line where he initializes 4 variables?
bounds, s, t, j = (0,0), -float('infinity'), 0, 0
- snprbob86 18y agoYes, and the `bounds, s = (j, i+1), t` especially when forced onto the same line as the if statement. See the Python Style Guide: http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/ "Compound statements (multiple statements on the same line) are generally discouraged."
- brent 18y agoI agree about compound statements, but I think most people will use the tuple assignment style, especially when its simply initializing variables. There is no reason to expand it beyond one line.
- snprbob86 18y agoThere is a reason: it reduces the reading distance from variable to initial value. It also reduces the amount of effort you need to exert to map them to each other. This is especially true when you are using () which impact the meaning of ','. There's also no reason to keep it on one line :-) Newlines and equal signs are cheap; go wild!