3 ms·
Whoa, hold on, since when is 'is' preferred over '=='? What kind of python are you writing over there? Those are for totally different purposes. One tests equal
by aerovistae 11y ago
Whoa, hold on, since when is 'is' preferred over '=='? What kind of python are you writing over there? Those are for totally different purposes. One tests equality while the other tests identity.
- clintonc 11y agoFor example, 'if x == None' versus 'if x is None'. The latter is to be preferred (since identity is faster and more clear than comparison), but you see the former sometimes.
- aerovistae 11y agoYes that's the only case I know of where 'is' is regularly used.