PEP 308: Yet another syntax proposal.
Piet van Oostrum
piet at cs.uu.nl
Tue Feb 18 10:44:08 EST 2003
>>>>> marktrussell at btopenworld.com (Mark Russell) (MR) wrote:
MR> So how about an alternative: add a special method to the (python 2.3)
MR> bool type that works like this:
MR> cond = x > 10 # or any expression that yields a bool
MR> result = cond.choose(iftrue, iffalse)
MR> choose() would need to be a special method so that it can avoid
MR> evaluating the non-chosen branch.
So what about:
fun = cond.choose
...later...
result = fun(iftrue, iffalse)
every function call would have to check if its arguments should be lazily
evaluated.
Maybe introducing `special forms' as in Lisp would be nice.
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
More information about the Python-list
mailing list