PEP 308: A PEP Writer's Experience - PRO

Erik Max Francis max at alcyone.com
Mon Feb 10 00:45:36 EST 2003


Andrew Henshaw wrote:

> If it were possible, then we might have (arbitrarily choosing a
> qualifier)
> 
> def iff(cond, %expr1, %expr2):
>     if cond:
>         return expr1
>     else:
>         return expr2
> 
> Plus that whole lazy-evaluation-infinite-data-structures capability
> comes
> along as well (assuming someone very clever can develop it).

But you really already have this, with lambdas, just not as an implicit
syntax.  I'm not sure what the implicit syntax gets you, really, except
turning every conceivable line of code you run across into a minefield
-- is this argument going to be lazily evaluated (maybe never)?  Is this
one?  I have to keep checking back to the function definition and
looking for a % [or whatever might be chosen] to find out.  That sounds
kind of scary.

> I'm certainly opposed to adding line-noise artifacts to Python, but
> this
> would be very rarely used, it would be restricted to the def
> statement, and
> it would be documented along with the * and ** qualifiers.

I'm not sure this formulation really stands out as a big winner, when
you can already use zero-argument lambdas as thunks (provided you call
them when you want them) in the "very rare" (your words) case where you
need this.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ She glanced at her watch ... It was 9:23.
\__/ James Clavell
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list