On 27 November 2017 at 12:31, Kirill Balunov <[email protected]> wrote:
> As I can see at the moment, these cases should behave differently:
>
>>>> x, y = [1,2,3,4]             # must raise ValueError
>>>> x, y = iter([1,2,3,4])      # should work
>
> But at the same time, it violates current situation. So maybe, as you have
> said we need special syntax. I will think about it.

I would find this confusing. Consider where you don't have literals:

def f(vals):
    x, y = vals

data = [1,2,3,4]

f(data)
data = iter(data)
f(data)

Having the two calls behave differently would be a recipe for errors
as someone refactors the calling code.

Paul
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to