On Apr 22, 2014 8:28 AM, "Lucas Malor" <7vsfeu4pxg@snkmail.com> wrote:
>
> Sorry, I didn't read it carefully. Anyway, youe example can be written as:
>
>> for i in range(5):
>>     print(i, end=' => ')
>>     if i == 1:
>>         print('one')
>>     elif i == (2,3):
>>         print('tuple(two, three)')
>>     elif i in (2, 3):
>>         print('two or three')
>>     elif i > 3:
>>         print('more than three')
>>     else:
>>         print('unmatched')
>
> and it's much simpler to read. I suggested the switch statement for a simpler alternative to the if-elif chain.

<sigh> My code can be written as a series of static print statements too and that would be even easier to read. It's an *example* to illustrate use not actual useful code!

My point is that this Case class does what you want with no language changes. And looking at your sample above exactly how would your new switch statement be better than either my code or your if/elif chain?

--- Bruce
(from my phone)