As jamylak wrote, None simply not printed by Python shells.
This is convenient because all functions return something: when no value is specified, they return None :
>>> def f(): ... print "Hello" ... >>> f() Hello >>> print f()
This is why Python shells do not print the return value of None. print None is different, however, because it explicitly requests Python to print the None value.
As for comparisons, None not considered an infection.
The general rule for Python 2 is that objects that cannot be compared in any meaningful way do not throw an exception in comparison, but instead return some arbitrary result. In the case of CPython, an arbitrary rule is as follows:
Objects of different types, except numbers, are sorted by type; objects of the same types that do not support proper comparison are ordered by their address.
Python 3 throws an exception for meaningless comparisons such as 1 > None and comparisons done with max(1, None) .
If you need -infinity, Python offers float('-inf') .
Eol
source share