Self function

Paul Rubin http
Tue May 5 15:01:39 EDT 2009


Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> writes:
> def rvisit(node):
>     print node
>     if node and node.link is not None:
>         rvisit(node.link)

Less redundant (remember the extra "recursion" doesn't cost anything
if the compiler is sane enough to turn it into a jump):

 def rvisit(node):
     print node
     if node:
         rvisit(node.link)



More information about the Python-list mailing list