On 3/9/2010 1:48 PM Shane said...
Hi I am a newbie for PythonHere is a question, say I have a list L, function foo is: def foo(L): if L[0]> 0: return True if later I want another function goo which returns "True" when L[0] and L[1] are both> 0, i.e., def goo(L): if L[0]> 0 and L[1]> 0: return True
Here's one way... def foo(L,deep=0): return L[0] and not deep or foo(L[1:],deep-1) Subject to clean up. Emile -- http://mail.python.org/mailman/listinfo/python-list