[New-bugs-announce] [issue39816] More descriptive error message than "too many values to unpack"
Alex Hall
report at bugs.python.org
Sun Mar 1 14:35:48 EST 2020
New submission from Alex Hall <alex.mojaki at gmail.com>:
Based on the discussion in https://mail.python.org/archives/list/python-ideas@python.org/thread/C6QEAEEAELUHMLB23OBRSQK2UYU3AF5O/
When unpacking fails with an error such as:
ValueError: too many values to unpack (expected 2)
the name of the type of the unpacked object should be included, e.g.
ValueError: too many values to unpack (expected 2) from object of type 'str'
and if the type is exactly list or tuple, which are already special cased: https://github.com/python/cpython/blob/baf29b221682be0f4fde53a05ea3f57c3c79f431/Python/ceval.c#L2243-L2252
then the length can also be included:
ValueError: too many values to unpack (expected 2, got 3) from object of type 'tuple'
----------
components: Interpreter Core
messages: 363083
nosy: alexmojaki
priority: normal
severity: normal
status: open
title: More descriptive error message than "too many values to unpack"
type: enhancement
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39816>
_______________________________________
More information about the New-bugs-announce
mailing list