FW: [Python-Dev] conditional expressions?

Paul Rubin phr-n2001d at nightsong.com
Mon Oct 15 17:15:17 EDT 2001


"Tim Peters" <tim.one at home.com> writes:
> Some examples where parentheses *are* required:
> 
>     (if 1 then 2 else 3) + 4
>     a[(if i then 2 else 3) : 4]

Hmmm, this looks error prone.  What happens if you omit the parentheses
in these examples?  Are they equivalen to

   if 1 then 2 else (3+4)

and

   if i then a[2] else a[3:4]

respectively?



More information about the Python-list mailing list