Python 3 raising an error where Python 2 did not
Terry Reedy
tjreedy at udel.edu
Fri Aug 26 15:52:20 EDT 2016
On 8/26/2016 4:50 AM, dfh at forestfield.co.uk wrote:
> In a program I'm converting to Python 3 I'm examining a list of divisor values, some of which can be None, to find the first with a value greater than 1.
>
> Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> None > 1
> False
The response 'False' is not a defined part of the language and no
program should depend on it. An earlier version of CPython and another
implementation of Python 1 or 2 might have said 1 or True. Then your
'first divisor > 1' would be None. Not good.
--
Terry Jan Reedy
More information about the Python-list
mailing list