[Python-ideas] Pattern Matching Syntax
Ed Kellett
e+python-ideas at kellett.im
Thu May 3 16:04:40 EDT 2018
On 2018-05-03 19:57, Chris Angelico wrote:
> Got it. Well, I don't see why we can't use Python's existing primitives.
>
> def hyperop(n, a, b):
> if n == 0: return 1 + b
> if n == 1: return a + b
> if n == 2: return a * b
> if n == 3: return a ** b
> if n == 4: return a *** b
> if n == 5: return a **** b
> if n == 6: return a ***** b
> ...
Well, it'd be infinitely long, but I suppose I'd have to concede that
that's in line with the general practicality level of the example.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180503/963e9122/attachment.sig>
More information about the Python-ideas
mailing list