Q about tail recursion

François Pinard pinard at iro.umontreal.ca
Sun Feb 27 09:51:06 EST 2000


Robin Becker <robin at jessikat.demon.co.uk> writes:

> 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.

Yes, `None' is a Python natural for a "missing" result, and there are many
cases where such are usefully represented and handled.

> 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.

That might become too heavy (and probably slow), as "missing" is ubiquitous
when handling statistical or experimental data, for example.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list