For review: PEP 308 - If-then-else expression

Erik Max Francis max at alcyone.com
Mon Feb 10 00:39:35 EST 2003


holger krekel wrote:

> But
> 
>     <expr>
> 
> is a perfectly valid statement. e.g.
> 
>     somelist.append(1)
> 
> so
> 
>     if something:
> 
> would leave the parser having to look ahead of what this means.

Only if you want to converge the two syntaxes, which is in my opinion
optional.  You could just maintain that the conditional operator as a
standalone statement is illegal; if that's what you really meant, then
you write

	(if C: x else: y)

or write it as

	if C: x
	else: y

or

	if C:
	    x
	else:
	    y

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