LikeLy-Journey / SegmenTron

Support PointRend, Fast_SCNN, HRNet, Deeplabv3_plus(xception, resnet, mobilenet), ContextNet, FPENet, DABNet, EdaNet, ENet, Espnetv2, RefineNet, UNet, DANet, HRNet, DFANet, HardNet, LedNet, OCNet, EncNet, DuNet, CGNet, CCNet, BiSeNet, PSPNet, ICNet, FCN, deeplab)
Apache License 2.0
705 stars 162 forks source link

Use ==/!= to compare str, bytes, and int literals #14

Closed cclauss closed 4 years ago

cclauss commented 4 years ago

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% python

>>> classes = "pres"
>>> classes += "ent"
>>> classes == "present"
True
>>> classes is "present"
False
>>> 1 == 1.0
True
>>> 1 is 1.0
False
LikeLy-Journey commented 4 years ago

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% python

>>> classes = "pres"
>>> classes += "ent"
>>> classes == "present"
True
>>> classes is "present"
False
>>> 1 == 1.0
True
>>> 1 is 1.0
False

thanks for your work!