3 ms·
> it would be extremely surprising behaviour if the run-time type of the value being spread determined what kind of spread happened. The other reason to disti
by int_19h 8y ago
> it would be extremely surprising behaviour if the run-time type of the value being spread determined what kind of spread happened.
The other reason to distinguish * and double-* is because * works with any iterable, and dicts are themselves iterables (of their keys). So you can actually use * on dicts, it just does something different:
>>> d = {'a': 1, 'b' : 2}
>>> [*d]
['a', 'b']
You could arguably say that only * makes sense here since it's a list context. But then, as you say, function calls would still be ambiguous because they support both positional and named arguments. This keeps it all unambiguously consistent in all contexts.