Python paradigms

Aahz Maruch aahz at
Sun Apr 16 14:04:55 EDT 2000

In article <slrn8fk2kh.965.scarblac-spamtrap at>,
Remco Gerlich <scarblac-rt at> wrote:
>Pass functions?
>def exp_if(test, true, false):
>  if test: return true()
>  else: return false()
>x = exp_if(a is not None, lambda a=a,i=i: a[i].weeble, lambda: 0)
>Getting silly, though :)

It's not so silly if true() and false() are coroutines or generators.
That way you can get rid of the lambda.  ;-)
                      --- Aahz (Copyright 2000 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

"First one back from the bathroom gets to be the bottom."

More information about the Python-list mailing list