From f35c52d0732895e8b7a0b74e92bc04775891c6d6 Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Mon, 30 Sep 2002 22:13:04 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/showbase/PythonUtil.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 2fde49ea79..48595dd3be 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -344,6 +344,19 @@ def sameElements(a, b): return 0 return 1 +def contains(whole, sub): + """ + Return 1 if whole contains sub, 0 otherwise + """ + if (whole == sub): + return 1 + for elem in sub: + # The first item you find not in whole, return 0 + if elem not in whole: + return 0 + # If you got here, whole must contain sub + return 1 + def reduceAngle(deg): """ Reduces an angle (in degrees) to a value between -180. and 180.