From 4f52923069bf5797d403faf2e5a4f19be56ab14b Mon Sep 17 00:00:00 2001 From: Raphael Vallat Date: Sat, 29 Jul 2023 14:30:24 +0200 Subject: [PATCH] Fix in flatten_list for Python 3.12 --- pingouin/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pingouin/utils.py b/pingouin/utils.py index 3613bf8d..df4e4587 100644 --- a/pingouin/utils.py +++ b/pingouin/utils.py @@ -297,8 +297,6 @@ def _flatten_list(x, include_tuple=False): # If x is not iterable, return x if not isinstance(x, collections.abc.Iterable): return x - # Remove None - x = list(filter(None.__ne__, x)) # Initialize empty output variable result = [] # Loop over items in x @@ -315,6 +313,8 @@ def _flatten_list(x, include_tuple=False): result.append(el) else: result.append(el) + # Remove None from output + result = [r for r in result if r is not None] return result