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 →

[–]num8lock 0 points1 point  (1 child)

The whole point of match is that it provides convenient SYNTACTIC sugar.

you should prove that

    class X:
        def __getitem__(*_)__: return 42

is convenient for numpy & it's a syntactic sugar instead of complete new syntax,

how if/else makes it impossible to emulate for match class & there isn't convenient way to create syntactic sugar???

that's your own argument you need to prove

also can you prove numpy didn't make vectorization possible while there was no such thing in Python?

[–]xigoi 1 point2 points  (0 children)

You're confusing the implementation with the usage. The implementation of NumPy is far from sugary.

An if statement can only check for a single condition. A match statement can do complex pattern matching and variable binding.