Python == with or vs. in list comparison

后端 未结 2 1333
暖寄归人
暖寄归人 2021-01-19 12:28

When checking for equality, is there any actual difference between speed and functionality of the following:

number = \'one\'
if number == \'one\' or number          


        
2条回答
  •  广开言路
    2021-01-19 13:18

    Talking about functionality - no, these two approaches generally differ: see https://stackoverflow.com/a/41957167/747744

提交回复
热议问题