On 2020-06-25 03:00, Greg Ewing wrote:
On 25/06/20 7:50 pm, Anders Munch wrote:
Pascal is a precedent for this placement of 'case',
Yes, but it doesn't use it with "match". In fact it doesn't have
any keyword in front of the values to be matched; it goes like
case n of
1: ...;
2: ...;
3: ...;
end
If we did that in Python it would look like this:
case shape:
Point(x, y):
...
Line(x1, y1, x2, y2):
...
Circle(cx, cy, r):
...
What think folks of this?
IMHO it looks a lot like shell scripting, which isn't really a bad thing
in general, but the second form seems to lose some readability to me
--
Joseph
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/CYB2FCKAM5W5ZWP5LFBJYYGDA5ZWOTPJ/
Code of Conduct: http://python.org/psf/codeofconduct/