3 ms·
Prolog-style pattern matching is quite helpful, at least in Prolog :) I think Haskell-style might be a subset of Prolog-style. Python-style is destructuring wi
by olavk 18y ago
Prolog-style pattern matching is quite helpful, at least in Prolog :) I think Haskell-style might be a subset of Prolog-style.
Python-style is destructuring without pattern-matching, so its not really the same. The assignment will be executed whether the structures match or not - if they don't match (e.g. the right hand value is not a list or does not have the right size) an exception is raised.
Pattern matching would not be that useful in Python anyway I suppose (unless you program Python as if it was Haskell)