[issue39816] More descriptive error message than "too many values to unpack"

Dávid Nemeskey report at bugs.python.org
Thu Sep 2 04:29:14 EDT 2021


Dávid Nemeskey <nemeskeyd at gmail.com> added the comment:

+1. When starting out, I always got confused about this message ("too many values to unpack? Does that mean my function returned too many items, which could not be unpacked into the expected number? Oh no, the opposite...").

Also, please note that the stack trace usually shows the offending line (e.g. x, y, z = fn(...)), so it is easy to see how many values are _expected_. It would be even more helpful to (also) show how many we _got_.

----------
nosy: +nemeskeyd

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39816>
_______________________________________


More information about the Python-bugs-list mailing list