New submission from Jacob RR <xboxgamerma...@gmail.com>:

hi,

so I *think* that ValueError shows an error grammatically incorrect?
In python 2.7
>>> x = [1,2,3]
>>> f,x, a, b = [1,2,3]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: need more than 3 values to unpack

Should have said: Received 3 values to unpack ?
The problem with that is the list size is 3 and the error says that I need more 
than 3 values to unpack which is logically wrong **IMHO** (don't kill me if im 
mistaken)

Now if I try to do something else, for example:

>>> x = [1,2,3]
>>> a, b = [1,2,3]

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack

It says **too many** but I assign a few than the size of the list. am I the one 
who wrong here?

Now, I code in Python 3 I'm not a professional  like you, I'm novice and try to 
learn.. I'll get to the point, the same code in Python 3.7.6 (Anaconda, pip is 
disappoint me :< )

>>> a = [1,2,3]
>>> x,y = a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack (expected 2)

Should said something else because it received less values and expected should 
say 3 and not 2, correct?


thanks for reading.




PS: Sorry I'm not a native speaker and I might be wrong and am very sorry if 
time wasted.

----------
assignee: docs@python
components: Documentation
messages: 365842
nosy: Jacob RR, docs@python
priority: normal
severity: normal
status: open
title: Misleading grammatically of ValueError Message?
type: enhancement
versions: Python 3.7

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

Reply via email to