Can anyone please help me in understanding the following python code

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Thu May 30 06:43:52 EDT 2013


 <bhk755 <at> gmail.com> writes:

> 
> Thanks for the reply Chris.
> 
> I am newbie to python, so please excuse me if I am asking chilly questions.
> 
> Can you please explain more about the following sentence.
> "When it says "Splitting" with a single-element list, it then 
> immediately prints "Merging" and returns (because all the rest of the 
> code is guarded by the 'if'). Execution then continues where it left 
> off, in the parent."
> 
> Because I am not sure how the control can go back to top of the function
unless  there is no loops there.
>

It doesn't. The function simply returns and execution resumes in the parent,
i.e. in the calling function at depth-1, where it left off. In Python, a
return None is implied when a function falls off its end.

> Also, Can you please let me know how did you found out that I am using
Python 2 Interpreter.

print as a statement (without parentheses) only works in Python 2, in Python
3 print is a function.

> 
> Bharath
> 
> 







More information about the Python-list mailing list