None is an actual singleton object None != 0 in python. And yes, that method is correct (after you fix the error where you are checking the same condition for both cases), but it checks for more cases ...