Misleading error message of the day

Tim Chase python.list at tim.thechases.com
Thu Dec 8 12:41:17 EST 2011


On 12/08/11 09:30, Roy Smith wrote:
> On Thursday, December 8, 2011 9:47:02 AM UTC-5, Robert Kern
> wrote:
>
>> Would including the respective numbers help your thought
>> processes?
>>
>> ValueError: too many values to unpack (expected 2, got 3)
>
> I don't know if that would have done the trick for me on this
> particular one.  On the other hand, adding "expected X, got Y"
> to the  message would generally be a good thing.

given the nature of the message, and the interaction with 
iterators-of-arbitrary/infinite length, it might have to be 
reduced to

   "Expected N, got more"

or for the case where you didn't get enough, you know how many 
you got: "Expected N, but only got M".  But the extra information 
would certainly be useful in tracking it down.

-tkc






More information about the Python-list mailing list