[gdal-dev] testsuite question

Even Rouault even.rouault at spatialys.com
Mon Apr 23 01:32:25 PDT 2018


On lundi 23 avril 2018 11:54:25 CEST Ben Elliston wrote:
> Hi Even
> 
> The testsuite has numerous instances like this:
> 
>     if version_info >= (3, 0, 0):
>         for i in range(100000):
>             exec("f.write(b'\\xa0\\x86\\x01\\x00\\x00\\x00\\x00\\x00')")
>     else:
>         for i in range(100000):
>             f.write('\xa0\x86\x01\x00\x00\x00\x00\x00')
> 
> Why is it necessary on Python 3 to use exec() in this way?  It seems
> very complicated and counterintuitive.

Probably a remain of an era where we tried to be compatible of python 2.5. I see python >= 
2.6 supports b'foo'  so we could probably only use the b'' syntax whereever python3 needs it

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180423/69ec0e25/attachment.html>


More information about the gdal-dev mailing list