New submission from Alex Hall <alex.moj...@gmail.com>:

Based on the discussion in 
https://mail.python.org/archives/list/python-id...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue39816>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to