[Python-ideas] values in vs. values out

Masklinn masklinn at masklinn.net
Thu Jan 13 22:10:30 CET 2011

On 2011-01-13, at 21:11 , Jason Orendorff wrote:
> (c) Unlike ML, you can write
>        (a, b) = [1, 2]
>      or generally
>        a, b = any_iterable
>      It is useful for unpacking to depend on the iterable protocol
>      rather than the exact type of the right-hand side. This is a
>      nicety that ML-like languages don't bother with, afaik.
In no small part because, in ML-type languages (or more generally in functional languages, Erlang could hardly be called an ML-like language) lists (or more generally sequences) and tuples are very different beasts and entirely incompatible. So the language has no way to make sense of a pattern match between a tuple and a list, except maybe by considering that the list is a cons and that a tuple is a dotted pair.

More information about the Python-ideas mailing list