pep 308: why doing (almost) nothing suffices

Terry Reedy tjreedy at
Mon Mar 10 04:43:08 CET 2003

"Edward K. Ream" <edream at> wrote in message
news:YWQaa.2838$ES3.2225226 at

> Naturally this isn't very good, or pep 308 wouldn't exist.  My
> insight" in the tub was simply that once could define another
version of
> this code:
> def choose_eval(cond, a, b): # warning: evals all arguments
>     if cond: return eval(a)
>     else: return eval(b)

How is your quote proposal significantly different in effect from
lambda-izing and then calling the arguments, which can also be done
today (as has already been discussed)?

def choose(cond, a, b):
  if cond: return a()
  else return b()

choose(y!=0,  lambda: x/y, lambda: BIGNUM).  Using lambda gets
expression parsed (and syntax-error checked) as compile time.

Terry J. Reedy

More information about the Python-list mailing list