It's beautiful ...
It returns None in the case where val != 0 which to me make sense.
Python 2.6.1 (r261:67515, Jun 18 2009, 17:24:16)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def test(val):
... if 0 == val:
... return 8
...
>>> a = test(8)
>>> print a
None
>>> print test(0)
8
>>>
Do you have any arguments why you think the behavior is wrong?
You can use c++ if you need strong compile time type checking but for python it seems extremely flexible and I assume that's what you want when you selected python for your task.