JD wrote:
> 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:
>        iterSomething(output)
>    else:
>        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:

   if has_something:
       return iterSomething(output)
   else:
       return output

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?

Gary Herron



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to