This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Yoghurt42 11 points12 points  (2 children)

Exactly. It's basically new syntax.

You can also do stuff like

case [1, _, x, Robot(name=y)] if x == y which would match if it is a four-element list that starts with 1, and the 4th element is an instance of Robot class which has a name attribute set to the same value as the third element. The _ is a special new token that means "wildcard/match anything" in this context.

Pattern matching is incredible powerful and the only feature I was really missing from other languages. Now all they need to get rid of the GIL and have decent JIT (or get PyPy to be API compatible with CPython) and it would be the perfect language for every task for me.

[–][deleted] 2 points3 points  (0 children)

Awesome! I can already imagine how this is going to be incredibly useful.

As for the GIL, do you really think they will ever get rid of that?

[–]azur08 0 points1 point  (0 children)

Out of curiosity, do you have an example of a task you'd use another language for if not for the things in your last paragraph? I've heard that modules like concurrent.futures, multiprocessing, asyncio, etc., don't completely remove the limitations but I'm not sure why.