In javascript, there are strict comparison operators op1 === op2
and op1 !== op2
that will compare both type and value. Is there a pythonic way of achieving the same thing?
So far I've only been able to come up with the following messy conditionals:
isinstance(op1, type(op2)) and isinstance(op2, type(op1)) and op1 == op2
and
not isinstance(op1, type(op2)) or not isinstance(op2, type(op1)) or op1 != op2
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…