]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Improve commentary about edges normalization
authorLele Gaifax <lele@metapensiero.it>
Wed, 9 Nov 2022 07:53:44 +0000 (08:53 +0100)
committerLele Gaifax <lele@metapensiero.it>
Wed, 9 Nov 2022 07:53:44 +0000 (08:53 +0100)
lib/sqlalchemy/dialects/postgresql/ranges.py

index 80e157a65375da5382843f976e38e1c67dc9969c..c35b6d89d43f1e72a7307cf77961af09ac9756d3 100644 (file)
@@ -171,7 +171,12 @@ class Range(Generic[_T]):
         step = self._get_discrete_step()
 
         if step is not None:
-            # "Normalize" the two edges as '[)', to simplify successive logic
+            # "Normalize" the two edges as '[)', to simplify successive
+            # logic when the range is discrete: otherwise we would need
+            # to handle the comparison between ``(0`` and ``[1`` that
+            # are equal when dealing with integers while for floats the
+            # former is lesser than the latter
+
             if value1_is_lower_bound:
                 if not value1_inc:
                     value1 += step