[BangPypers] confused about behaviour of None in python

Vivek Puri vpuri.social at gmail.com
Sat Sep 14 12:22:01 CEST 2013


Hi,
> I tried
>
> In [55]: None < 10
> Out[55]: True
>
> It gives me output  True .
> it suppose to give me error .
> Please explain me None < 10  is  True .
>

In python2 None is always considered "lowest" value so, None will always 
be < any other value. Which explains the result you are getting.
In Python3 it will raise an exception because two values are of 
different type.


rgds
vivek


More information about the BangPypers mailing list