Is there a Python equivalent to Erlang's pattern matching?
If I had a list of five things and I was only interested in the third and
fifth of them, I would do this in Erlang:
[_First, _Second, Third, _Fourth, Fifth] = ListOfFiveElements,
The underscores means that I don't care about those variables and the end
result is that Third and Fifth are bound to what's in the third and fifth
place in that list. How do I best do the same in Python?
No comments:
Post a Comment