Camion <camion_spam-pyb...@yahoo.com> added the comment:

Jerry, I've been troubleshooting thing for 30 years and I'm quite experienced 
at it, and in the end I was perfectly able to manage this problem and solve 
this problem by myself. 

My point is not about my own difficulty to solve this problem, but about the 
fact that an information was lacking clarity in a language which claims that 
things must be told. You mention the fact that Steven suggested playing playing 
around with simplified code, but it's not what Steven suggested. Steven 
suggested to make the example simpler, and I replied him that this example was 
not chosen to describe the programming situation but illustrate the 
troubleshooting situation and provide a good way to show how a real situation 
might be problematic to analyse with this message - and Steven confirmed that 
he was also put out on a wrong track by this message. 

For sure, when you are an experienced programmer, you will develop a different 
way to understand this. My point is that it seems to go in contradiction with 
"Python's Zen".

You suggest that I should have split the packing and the unpacking on two 
separate lines. Ok, but this is an easy suggestion to make _when you already 
know the cause of the problem_. Each language has it's programming culture and; 
Ok, I'm new here but I haven't seen any recommendation going in that direction. 
On the contrary all the sample code and course I have seen on that topic 
encourage young programmer not to use this practice - and I believe it would be 
simpler to find a way to adapt the error message to make things clear that such 
an error can also arise for unpacking reasons (whatever the way you word it), 
than to change the programming/training culture around python.

I have been made multiple propositions to re-word this message, and Steven also 
made some. My last proposition was motivated by the idea of keeping the message 
short. Some other were longer. One might also write : "not iterable (this 
problem may sometimes arise from unpacking)" or something else.

The point is that in many situation, the problem comes from a mismatching 
between the number of values packed and the number of destination positions for 
unpacking; and in this case, you have a ValueError message stating clearly what 
happens. 

Only in this case, when the fact that you had only one value and didn't see it, 
makes that you no longer have an iterable type - do you get a TypeError. And 
Ok, I agree with Serhiy that the type of exception is correct, but I believe 
that the whole situation is misleading and should be corrected.

(I apologize for my long sentences : My mother tongue is french and it's not 
always easy for me to to make them short like you do in English XD )

----------

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

Reply via email to