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

malcomvx report at bugs.python.org
Tue May 25 02:01:29 EDT 2021


malcomvx <malcomvx at tutanota.com> added the comment:

Python functions can return multiple variables . These variables can be stored in variables directly. This is a unique property of Python , other programming languages such as C++ or Java do not support this by default.

The valueerror: too many values to unpack occurs during a multiple-assignment where you either don't have enough objects to assign to the variables or you have more objects to assign than variables. If for example myfunction() returned an iterable with three items instead of the expected two then you would have more objects than variables necessary to assign to.

http://net-informations.com/python/err/value.htm

----------
nosy: +malcomvx

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


More information about the Python-bugs-list mailing list