Closed tjone270 closed 5 years ago
Cool! I need to take it to 1.0 branch with some other additions from here https://gist.github.com/em92/9a7ce6984261cb37c6ebe79b558d772c
Currently list is old, some fixes are already included in 0.5.2. Wanted to release 1.0.0 version, but failed during testing, 'cos servers were constantly crashing.
I will find time to make 1.0 branch later.
Btw, expressions like 'a < b < c' work in python and are more readable. So, I suggest to edit your commit
Hi @em92,
I don't think I could use chained comparisions here, as they work slightly differently to my standard method.
Excerpt from the Python documentation on expressions:
Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x < y and y <= z, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false).
Formally, if a, b, c, …, y, z are expressions and op1, op2, …, opN are comparison operators, then a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z, except that each expression is evaluated at most once.
Note that a op1 b op2 c doesn’t imply any kind of comparison between a and c, so that, e.g., x < y > z is perfectly legal (though perhaps not pretty).
I don't think I could use chained comparisions here
3 <= int(self["g_gametype"]) < 12
Didn't understand, why not?
You're right, I was doing it incorrectly.
It's often useful to be able to determine if the current game is a team one or not easily.