Builtin function versus new syntax for PEP308 -- was Re: PEP308: Yet another syntax proposal

Carel Fellinger carel.fellinger at chello.nl
Thu Feb 13 02:39:26 CET 2003


On Wed, Feb 12, 2003 at 07:19:19PM +0000, Gareth McCaughan wrote:
...
> How does this
> 
>     name = (if user: user.get_name() else: "Nobody")
> 
> require more thought than this?
> 
>     if user:
>         name = user.get_name()
>     else:
>         name = "Nobody"

I was a bit surprised too, but in my litle usability study mentioned
elsewere all the participants (3:) had considerably more difficulty
understanding the (if...) expression then the if statement.  The now
rejected form "true-value if cond else false-value" on the other hand
was parsed and understood as fast as the if-statement.


-- 
groetjes, carel





More information about the Python-list mailing list