Pyhon 2.x or 3.x, which is faster?

BartC bc at freeuk.com
Mon Mar 7 20:41:18 EST 2016


On 08/03/2016 01:19, Steven D'Aprano wrote:
> On Tue, 8 Mar 2016 07:19 am, BartC wrote:
>
>> I don't have to hand a jpeg file that it can't
>> decode.
>
>
> Run this under Python 2:
>
>
>
> from random import randint
> blob = [randint(0, 256) for i in range(16*1024)]
>
> with open('broken.jpg', 'wb') as f:
>      f.write(''.join(blob))
>
>
>
>
> If your software can decode that, it will be a miracle.
>

That's not a jpeg file.

(You code didn't run even on Python 2, but I created a 16KB file of 
random bytes by other means. It said 'Reading past end of data', 
presumably looking for some marker or other.)

-- 
Bartc



More information about the Python-list mailing list