Py3K idea: why not drop the colon?

James Cunningham jameshcunningham at gmail.com
Fri Nov 10 21:34:01 CET 2006


On 2006-11-10 15:24:50 -0500, Bjoern Schliessmann 
<usenet-mail-0306.20.chr0n0ss at spamgourmet.com> said:

> 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?
> 
> Regards,
> 
> 
> Björn

Yes, I'm not sure myself.

In [1]: color = "red"

In [2]: if color == "red" or "blue" or "green":
   ...:     print 'Works.'
   ...:
   ...:
Works.

In [3]: if color == "blue" or "red" or "green":
   ...:     print 'Works.'
   ...:
   ...:
Works.

In [4]: if not color == "blue" or "green":
   ...:     print 'Works.'
   ...:
   ...:
Works.




More information about the Python-list mailing list