Py3K idea: why not drop the colon?

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Nov 11 01:45:51 CET 2006


On Fri, 10 Nov 2006 21:24:50 +0100, Bjoern Schliessmann wrote:

> Marc 'BlackJack' Rintsch wrote:
> 
>> No it doesn't -- look again at the example given above.  It's
>> legal syntax in Python but doesn't have the semantics implied by
>> the example.
> 
> Sorry, I don't understand -- what is the difference between the
> example as it is and the implied semantics of it?

Inform 6 "x == blue or red or yellow" is equivalent to the Python
 
x == blue or x == red or x == yellow

or if you prefer:

x in (blue, red, yellow)

And just for the avoidance of doubt, Python "x == blue or red or yellow"
is semantically equivalent to:

(x == blue) or bool(red) or bool(yellow)



-- 
Steven.




More information about the Python-list mailing list