None is negative?

Mithrandir mithrandiragainwiki at mailinator.com
Tue Aug 3 22:34:40 CEST 2010


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

On 08/03/2010 01:28 PM, Mithrandir wrote:
> 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.
> 
That and/or it works out better in Python 3. :)

- -- 
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/

iQEcBAEBAgAGBQJMWH1gAAoJEKo37V1xH7gTPSIH/igigROvz8NOy/Km5SEAPtUE
08Brr46qeqZzkKPxV/r8wH2uD4eIhHoaBUN0oOv+7FT1UoP89eg7E0eC7U8FtzXY
5uwgEXG4xHTLPCERK4UkX799zD6oVQ7eeoSmnKmbotXEbUEjZ6TONq3ErXZBn6g0
FqHX6S/GdrVvIvqjuePYNJYYC/CsF3qXDpkM69Iye0MqGsZGPaKsrmsCa2cPVI+P
ZZ67nXeHEsgYZ91utu4Hb4yOtmZf8MFqFqyD8aYF2Tr1P3uEBe8WOUqIPGRkwrFF
Nxw1Ne/pw2v++CDLbJUS6+rpN52IYEeBLawtUarc/iG4RG+KFE7Z0ss8jSr75+c=
=uXl5
-----END PGP SIGNATURE-----



More information about the Python-list mailing list