rasterio / affine

Affine transformation matrices
https://affine.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
159 stars 28 forks source link

Outdated code from python 2 / 3 compatibility #91

Closed Rotzbua closed 1 year ago

Rotzbua commented 1 year ago

I am not sure but I think this is outdated code for python2 and 3 compatibility? https://github.com/rasterio/affine/blob/28867073714191cfda929b89f2a3023d82e07e27/affine/__init__.py#L61-L78

sgillies commented 1 year ago

@Rotzbua thanks for bringing this up! Currently if you compare Affine instances for other than == you get a TypeError. If we were to delete all the existing compatibility code, you would get False. I think that's a fine result, but we might want to wait until a 3.0.0 to make a breaking change.

Rotzbua commented 1 year ago

My intention was to simplify the the code to just:

 # No implicit ordering (newer Python) 
 def assert_unorderable(a, b): 
     """Assert that a and b are unorderable""" 
     return NotImplemented

Because with Python3 the exemption TypeError is always thrown and the else part is never executed.

sgillies commented 1 year ago

Cool, I'll leave at that for now.