Voting for PEP 308 (was Re: For review: PEP 308 - If-then-else expression)

Hans Nowak wurmy at earthlink.net
Tue Feb 11 12:55:47 EST 2003


I wrote:

> Laura Creighton wrote:
> 
>> Most of the people who don't care will also not be posting.  Or
>> voting. They're probably not reading comp.lang.python, either.  I
>> remember when 2.0 came out and people found out about string methods.
>> A whole bunch of them came back to post articles about how they
>> thought the new join syntax was really awful and ugly.  They only
>> cared after it got in, but enough to complain a lot.
> 
> 
> Hmm, what if bools grew an if() method?  We could then write:
> 
>   z = (x == y).if(whentrue, whenfalse)
> 
> This strikes me as much more elegant than the other proposals.
> 
> (ducking for cover, etc :-)

Or rather, to be more in the spirit of the PEP and the join() method, maybe it 
should be:

   z = whentrue.if(cond, whenfalse)

Of course, all objects would have to grow the if() method for this. :-)

-- 
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.awaretek.com/nowak/kaa.html
Soon: http://zephyrfalcon.org/





More information about the Python-list mailing list