Q about tail recursion

Robin Becker robin at jessikat.demon.co.uk
Sun Feb 27 05:48:49 EST 2000


In article <000801bf8105$18b99ba0$172d153f at tim>, Tim Peters
<tim_one at email.msn.com> writes
...
>
>Seems so, except in a function that explicitly does "return None" as well
>as, e.g., "return 42".  That's rare in my experience.  However, I've
>detected subtle evidence that our experiences sometimes differ <wink>.
>Doing
>
>    none = None
>    return none
>
>would be an adequate workaround.
>
>If you write such a utility, I bet PythonWin and IDLE would like to adopt
>it!  I expect "do some sanity checks" to become an increasingly popular
>feature of the Python IDEs, and I'd  hate to think that tabnanny.py is the
>best sanity-checker the community can come up with <wink>.
>
>encouragingly y'rs  - tim
...

I quite often want to use None as an exceptional return eg in the case
of a list returning function [] might be a legal return and None an
illegal one. That way I can leave the error handling to the caller. I
guess I should really be raising an exception though to be truly
pythonian.
-- 
Robin Becker



More information about the Python-list mailing list