From 3c054aff732f47dc6a4fca65de869241a6f66070 Mon Sep 17 00:00:00 2001 From: Prodesire Date: Tue, 16 Jan 2018 01:02:47 +0800 Subject: [PATCH] add list.tolist which converts obj to list --- pydu/list.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pydu/list.py b/pydu/list.py index 503bb3a..509df48 100644 --- a/pydu/list.py +++ b/pydu/list.py @@ -15,3 +15,9 @@ def uniq(seq, key=None): seen.add(uniq_value) uniq_list.append(value) return uniq_list + + +def tolist(obj): + if not isinstance(obj, list): + return [obj] + return obj