Q about tail recursion

Moshe Zadka moshez at math.huji.ac.il
Sun Feb 27 05:36:29 EST 2000


[Tim]
> And if a def is sometimes meant to return a value and
> sometimes not, redesign the code before you drive yourself
> insane <wink>.
> 
[Moshe Zadka]
> I've thought about writing a small utility to warn me about such
> functions, which should be easy enough: either all or none of
> "RETURN_VALUE" opcodes should be preceded by LOAD_CONST of None.

[Tim]
> Seems so, except in a function that explicitly does "return None" as well
> as, e.g., "return 42". 

Nope, that would be LOAD_GLOBAL of None

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

After reading the mathematics behind tabnanny, I doubt mine will be able
to compete with it.

humbly y'rs, Z.
--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list