None is negative?
Chris Rebert
clp2 at rebertia.com
Tue Aug 3 16:42:21 EDT 2010
On Tue, Aug 3, 2010 at 1:29 PM, Grant Edwards <invalid at invalid.invalid> wrote:
> On 2010-08-03, wheres pythonmonks <wherespythonmonks at gmail.com> wrote:
>
>> I did the google search... I must be blind as I don't see any hits...
>>
>> None is negative in Python? (v2.6)
>
> Not really.
>
>> 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?
>
> Use Python 3.x. Or perhaps there's a "from future import xxxx" way to
> do that as well... Is there a list of available "from future"
> features somewhere? I can't seem to figure out how to get Python
> itself to give me a list -- my copy of Python 2.6 insists there's not
> module named future.
The module is named __future__. But there's no __future__ import to
change the comparison behavior:
Python 2.7 (r27:82500, Jul 27 2010, 23:28:51)
>>> __future__.all_feature_names
['nested_scopes', 'generators', 'division', 'absolute_import',
'with_statement', 'print_function', 'unicode_literals']
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list