[Pythonmac-SIG] Some test code

Henning Hraban Ramm hraban at fiee.net
Thu Feb 3 08:48:39 CET 2011


Am 2011-02-03 um 05:45 schrieb Chris Rebert:

>> if (card == "Hearts" or card == "Diamonds"):
>>     print "That card is Red"
>>
>> elif (card == "Spades" or card == "Clubs"):
>>     print "That card is Black"
>
> Note that the parentheses are completely unnecessary and not  
> idiomatic style.
>    if card == "Hearts" or card == "Diamonds":
> is the normal way of writing compound conditions.

or even:

if card in ('Hearts', 'Diamonds'):


Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)






More information about the Pythonmac-SIG mailing list