It appears that if x is almost like short-hand for the longer if x is not None syntax. Are they functionally identical or are there cases where for a given value of x the two would evaluate differently?
I would assume the behavior should also be identical across Python implementations – but if there are subtle differences it would be great to know.
In the following cases:
the
iftest will differ:This is the case because
istests for identity, meaningis equivalent to
therefore