test for None

BartlebyScrivener rpdooling at gmail.com
Tue Apr 18 21:10:10 EDT 2006


How do you test for a function that returns nothing, and why doesn't
this work? Shouldn't X have to be either None or not?

>>>x = None
>>> for x in []:
... 	if x is None:
... 		print "X is None"
... 	else:
... 		print "X is not None"
... 		

Thanks,

rick




More information about the Python-list mailing list