Arnon Yaari added the comment:

I couldn't find a way to add 'got %d' to the 'too many values' message. This 
would either require going over the rest of the iterator (which will take more 
time and may never return) or trying to figure out if it has a 'len' member. I 
didn't find any place in the current code that does something like this and 
writing one myself is too error prone (there are so many cases...). 
PyObject_Size returns an error if I try to use it for this purpose.

I found another message with "need more than ..." that I improved in the same 
way. This message is for when trying to execute:
  >>> a, *(b, c, d) = 1, (2, 3), (4, 5)
Now it outputs the message for the star unpacking:
  ValueError: not enough values to unpack (expected 3, got 2)
which is confusing in this use case but still better than before. Oh my!

----------
Added file: http://bugs.python.org/file39039/issue23949.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23949>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to