From 72f4d7e6744eb98e646e579f6123fdc194271995 Mon Sep 17 00:00:00 2001 From: Lele Gaifax Date: Wed, 9 Nov 2022 08:53:44 +0100 Subject: [PATCH] Improve commentary about edges normalization --- lib/sqlalchemy/dialects/postgresql/ranges.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py index 80e157a653..c35b6d89d4 100644 --- a/lib/sqlalchemy/dialects/postgresql/ranges.py +++ b/lib/sqlalchemy/dialects/postgresql/ranges.py @@ -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 -- 2.47.3