Steven D'Aprano <[email protected]> added the comment:
I think the error messages could be improved.
In the first example: `f,x, a, b = [1,2,3]`
you are unpacking three values, but you need to unpack 4. The error message is
not very helpful: 5 values is "more than 3" but it would be too many, you need
not "more than 3" but exactly 4.
In the second example `a, b = [1,2,3]` it would be nice if it would tell you
how many values you need to unpack.
Ideally, the message would say something like:
Need to unpack 4 values but got 3 # first example
Need to unpack 2 values but got 3 # second example
However I don't know if this is possible with the current parser, it might not
be possible until the parser is changed (maybe in 3.9?)
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40202>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com