一、PEP8类
1 This inspection highlights chained comparisons that can be simplified
I have an integer value x, and I need to check if it is between a start and end values, so I write the following statements:
if x >= start and x <= end:
# do stuff
解决方法:
In Python you can “chain” comparison operations which just means they are "and"ed together. In your case, it’d be like this:
if start <= x <= end:
Reference: https://docs.python.org/3/reference/expressions.html#comparisons
来源:https://stackoverflow.com/questions/26502775/pycharm-simplif