Python paradigms

Michael Hudson mwh21 at cam.ac.uk
Sun Apr 16 14:06:31 EDT 2000


scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes:

> 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 :)

Watch out, you'll be writing code in cps (continuation passing style)
next...

Cheers,
M.

-- 
  well, take it from an old hand: the only reason it would be easier
  to program in C is that you can't easily express complex  problems
  in C, so you don't.                   -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list