From b00beae561deeba3fb8dd7e214c17e404c10a703 Mon Sep 17 00:00:00 2001 From: Dag Brattli Date: Tue, 28 Nov 2023 15:44:04 +0100 Subject: [PATCH] Move all logic inside match statement --- src/fable-library-py/fable_library/util.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/fable-library-py/fable_library/util.py b/src/fable-library-py/fable_library/util.py index 45cc9775bb..2fd2be0d3b 100644 --- a/src/fable-library-py/fable_library/util.py +++ b/src/fable-library-py/fable_library/util.py @@ -217,11 +217,9 @@ class DateKind(IntEnum): def equals(a: Any, b: Any) -> bool: - if a is b: - return True - - # Check for NoneTypes (ex Some [1] = None) match (a, b): + case (a, b) if a is b: + return True # Don't test (None, None) here, because a is b already covers that # case (None, None): # return True @@ -229,13 +227,10 @@ def equals(a: Any, b: Any) -> bool: return False case (_, None): return False - case (_, _): - pass - - if is_array_like(a): - return equal_arrays(a, b) - - return a == b + case (a, b) if is_array_like(a): + return equal_arrays(a, b) + case _: + return a == b def is_comparable(x: Any) -> bool: