return in loop for ?

bonono at gmail.com bonono at gmail.com
Thu Nov 24 04:25:25 EST 2005


Duncan Booth wrote:
> To bonono, not Steve:
>
> So if a function should religiously have only one exit point why does the
> example you give have two exit points? i.e. the 'return r', and the implied
> 'return None' if you execute the 'something' branch.
I may have remember it wrong, but don't ask me. I am not the one
advocate of it. Oh, you mean the something. It is that I forgot what it
was, the original one did have one return.

> Arguments include: any cleanup code you need when returning from a function
> is all in one place (mostly applicable to languages where you have to do
> your own memory management---see the recent AST discussion on the python
> dev list); or it stops you accidentally forgetting to return a value (as
> demonstrated above :^) )
The faintly remember it was about the last reason, or why it has been
brought up.




More information about the Python-list mailing list