Author Jacob RR
Recipients Jacob RR, docs@python
Date 2020-04-06.08:16:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586160974.41.0.711704681431.issue40202@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-04-06 08:16:14Jacob RRsetrecipients: + Jacob RR, docs@python
2020-04-06 08:16:14Jacob RRsetmessageid: <1586160974.41.0.711704681431.issue40202@roundup.psfhosted.org>
2020-04-06 08:16:14Jacob RRlinkissue40202 messages
2020-04-06 08:16:13Jacob RRcreate