On 19 April 2014 08:52, Bruce Leban bruce-at-leapyear.org |python-ideas-at-python..org| <vajg1g2cqt@sneakemail.com> wrote:
Here's a simple class that provides case like syntax. How would modifying the language be better than this?
I don't like the additional unneeded Case indentation. That's why I'm proposing a syntax with switch on the same line with the first case.
for i in range(5):print(i, end=' => ')case = Case(i)if case(1):print('one')elif case((2,3)):
print('tuple(two, three)')
elif case(2, 3):print('two or three')elif case > 3:print('more than three')
else:
print('unmatched')