None is negative?

Mithrandir mithrandiragainwiki at mailinator.com
Tue Aug 3 22:28:49 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/03/2010 01:17 PM, wheres pythonmonks wrote:
> I did the google search... I must be blind as I don't see any hits...
> 
> None is negative in Python?  (v2.6)
> 
> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python
> 
>>>> if None < -9999999.99: print "hi"
> 
> hi
>>>>
> 
>>>> if -9999999 > None: print "hi"
> 
> hi
>>>>
> 
> Is there a way to have the comparison raise an exception?
> 
> W

I believe it's also because None lacks any binary value at all, whereas
- -99999999.99 or 0 have a value in binary.

For example:

if None < 0: print "hi"

>>> hi

if None > 0: print "hi"

>>>

But in human terms, None == 0 and None > -9999999.99.

- -- 
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
"All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
- From the ashes a fire shall be woken,
a light from the shadows shall spring;
renewed shall be blade that was broken,
the crownless again shall be king."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMWHwBAAoJEKo37V1xH7gTgvYH/j1j0fgKI5mlzIp4urxhh6Ki
49LVsZjVsISyD+NzvgV5b8hk0S9Ad+gpqaf8fBQJS36Ye1KtupA7W7CTr54roaK0
ZBN3o4XxPdRjxXeHnBUNi3bqjGMzDdIIFZbE/qKalxTj0ZYgtlCgnMiYXLEeeY5z
L0dzfn/qoMr6PjAtdlB9yp5amHcUeRzDos3hp13flsAj9Vq/pHyJmlPazME/vE0f
381bMXP52ud71BGcm8gRWdDqhJOUdJ52NZeEk0fKcxHsRvscjt1nQmCRp4IMDtFl
ws++tXcl0pY7KSAATb5dzzkhr/BJnKGb1JHRlQMMB0EEdtNOzJaDh63qbvSzTJI=
=9jHw
-----END PGP SIGNATURE-----



More information about the Python-list mailing list