Stop writing Python 4 incompatible code

BartC bc at freeuk.com
Wed Jan 13 20:49:48 EST 2016


On 14/01/2016 01:21, Chris Angelico wrote:
> On Thu, Jan 14, 2016 at 12:02 PM, BartC <bc at freeuk.com> wrote:
>> I was surprised recently by just how much incompatibility there was between
>> Python 2 and 3. It wasn't just about print with parentheses and range
>> instead of xrange.
>>
>> I wanted to try out a jpeg decoder with PyPy and the three different ones I
>> could find only worked with 2.x. Attempts to fix the incompatibilities
>> usually lead to deeper mire.
>
> This implies that there are many differences between 2.x and 3.x.
>
>> In the end it was easier to put together my own version, which ran on all
>> Pythons (2.7 to 3.4). It was surprisingly easy to do; no need for
>> conditional version code.
>
> But this implies that the differences are pretty simple. Which
> argument are you putting?

That they are plenty of differences but I was adept at avoiding them!

They didn't come up in my 700-line module anyway, except for the use of 
'bytearray' which required upgrading from 2.5 to 2.7. (I needws to make 
use of bytearrays otherwise it could run out of memory on large inputs.)

-- 
Bartc



More information about the Python-list mailing list