How to pass out the result from iterated function
gherron at islandtraining.com
Wed Dec 10 21:26:40 CET 2008
> I got a iterated function like this:
> def iterSomething(list):
> has_something = False
> for cell in list:
> if something in cell:
> has_something = True
> output = something
> if has_something:
> final_out = outupt
> The problem is how can I read this final_out outside of the function.
> I tried the global statement, it seems not work. Any idea?
Without examining the intent of your code, I'll suggest this:
So either way, *something* is returned, and in the case of the recursive call, the innermost result is returned back up through all levels of the recursion.
Is that what you wanted?
More information about the Python-list