Re: Misleading error message of the day

2011-12-10 Thread Lie Ryan
On 12/09/2011 03:57 PM, alex23 wrote: On Dec 9, 11:46 am, Lie Ryan wrote: perhaps the one that talks about `a, a.foo = 1, 2` blowing up? Are you sure you're not confusing this with the recent thread on 'x = x.thing = 1'? Ah, yes I do -- http://mail.python.org/mailman/listinfo/python-list

Re: Misleading error message of the day

2011-12-09 Thread Ethan Furman
Jean-Michel Pichavant wrote: Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever p

Re: Misleading error message of the day

2011-12-09 Thread Roy Smith
In article , Jean-Michel Pichavant wrote: > Ethan Furman wrote: > > Jean-Michel Pichavant wrote: > >> You have to opportunity to not use unpacking anymore :o) There is a > >> recent thread were the dark side of unpacking was exposed. Unpacking > >> is a cool feautre for very small applications

Re: Misleading error message of the day

2011-12-09 Thread Jean-Michel Pichavant
Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible otherwise. Which thr

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
In article , Chris Angelico wrote: > http://thedailywtf.com/Series/Error_0x27_d.aspx > > This is getting quite off-topic though. Getting off-topic, perhaps, but your comment really does bring some closure. When I was pondering the original, "too many values to unpack" message, I did indeed

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 1:07 PM, Steven D'Aprano wrote: > I forget where I saw this, but somebody took a screen shot of an error > message from a GUI application that said something like: > > A fatal error occurred: no error > > and then aborted the app. An errant error! Sounds like the stuff that

Re: Misleading error message of the day

2011-12-08 Thread Steven D'Aprano
On Thu, 08 Dec 2011 18:10:17 +, Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: >> On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant >> wrote: >>> string are iterable, considering this, the error is correct. >> >> Yes, I understand that the exception is correct. I

Re: Misleading error message of the day

2011-12-08 Thread Lie Ryan
On 12/09/2011 07:13 AM, Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
In article , Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: > > On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant > > wrote: > >> string are iterable, considering this, the error is correct. > > > > Yes, I understand that the exception is correct. I'm not saying t

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 7:58 AM, alister wrote: > not as useless as "Keyboard Error press F1 to continue" If it said "press F1 to ignore" then I would agree. This, however, is more akin to "replace user and strike any key to continue", but more implicit. ChrisA -- http://mail.python.org/mailman/

Re: Misleading error message of the day

2011-12-08 Thread alister
On Thu, 08 Dec 2011 18:10:17 +, Grant Edwards wrote: > On 2011-12-08, Roy Smith wrote: >> On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant >> wrote: >>> string are iterable, considering this, the error is correct. >> >> Yes, I understand that the exception is correct. I

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Benjamin Kaplan wrote: On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote: Benjamin Kaplan wrote: If the RHS was a tuple or a list, yes you could know immediately. But unpacking works with any iterable, so it probably doesn't special-case lists and tuples. Iterables don't have a size- they jus

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible otherwise. Which thread was that? ~Etha

Re: Misleading error message of the day

2011-12-08 Thread Robert Kern
On 12/8/11 4:21 PM, Chris Angelico wrote: On Fri, Dec 9, 2011 at 2:55 AM, Andrea Crotti wrote: Yes but how do you know how many values you generated when it quits? I mean I don't know how it work internally, but it should keep a temporary list of the yielded values to be able to find out how ma

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: string are iterable, considering this, the error is correct. Yes, I understand that the exception is correct. I'm not saying the exception should be changed, just that we have the opportuni

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote: > Benjamin Kaplan wrote: >> >> On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: >>> >>> (some, >>>  very, >>>  long, >>>  list, >>>  of, >>>  variable, >>>  names, >>>  to, >>>  get, >>>  the, >>>  stuff, >>>  unpacked, >>>  into) = function_tha

Re: Misleading error message of the day

2011-12-08 Thread Ethan Furman
Benjamin Kaplan wrote: On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: (some, very, long, list, of, variable, names, to, get, the, stuff, unpacked, into) = function_that_should_return_a_14_tuple() raises ValueError: too many values to unpack Quick, what's the bug? Did I forget

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: > (some, >  very, >  long, >  list, >  of, >  variable, >  names, >  to, >  get, >  the, >  stuff, >  unpacked, >  into) = function_that_should_return_a_14_tuple() > > raises > > ValueError: too many values to unpack > > Quick, what's the bug?  Did

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
(some, very, long, list, of, variable, names, to, get, the, stuff, unpacked, into) = function_that_should_return_a_14_tuple() raises ValueError: too many values to unpack Quick, what's the bug? Did I forget a variable on the LHS, or is my function returning more things than it shou

Re: Misleading error message of the day

2011-12-08 Thread Grant Edwards
On 2011-12-08, Roy Smith wrote: > On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: >> string are iterable, considering this, the error is correct. > > Yes, I understand that the exception is correct. I'm not saying the > exception should be changed, just that we have

Re: Misleading error message of the day

2011-12-08 Thread Tim Chase
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 p

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 2:55 AM, Andrea Crotti wrote: > Yes but how do you know how many values you generated when it quits? > I mean I don't know how it work internally, but it should keep a temporary > list of the yielded values to be able to find out how many values are > there.. Iterator unpac

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 03:42 PM, Roy Smith wrote: Why not? Take this example: def i(): i = 0 while True: print "returning:", i yield i i += 1 a, b = i() ./iter.py returning: 0 returning: 1 returning: 2 Traceback (most recent call last): File "./iter.py", line 1

Re: Misleading error message of the day

2011-12-08 Thread Heiko Wundram
Am 08.12.2011 16:42, schrieb Roy Smith: The exception was raised when i() returned it's third value, so saying "expected 2, got 3" is exactly correct. Yes, it is true that it might have gotten more if it kept going, but that's immaterial; the fact that it got to 3 is what caused the Holy Hand

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
On Thursday, December 8, 2011 10:16:56 AM UTC-5, Heiko Wundram wrote: > Am 08.12.2011 15:47, schrieb Robert Kern: > > Would including the respective numbers help your thought processes? > > ValueError: too many values to unpack (expected 2, got 3) > > Not possible in the general case (as the right

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
On Thursday, December 8, 2011 10:03:38 AM UTC-5, Jean-Michel Pichavant wrote: > string are iterable, considering this, the error is correct. Yes, I understand that the exception is correct. I'm not saying the exception should be changed, just that we have the opportunity to produce a more useful

Re: Misleading error message of the day

2011-12-08 Thread Roy Smith
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

Re: Misleading error message of the day

2011-12-08 Thread Heiko Wundram
Am 08.12.2011 15:47, schrieb Robert Kern: Would including the respective numbers help your thought processes? ValueError: too many values to unpack (expected 2, got 3) Not possible in the general case (as the right-hand side might be an arbitrary iterable/iterator...). -- --- Heiko. -- http:

Re: Misleading error message of the day

2011-12-08 Thread Jean-Michel Pichavant
Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have been a,

Re: Misleading error message of the day

2011-12-08 Thread Robert Kern
On 12/8/11 2:23 PM, Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have be

Re: Misleading error message of the day

2011-12-08 Thread Chris Angelico
On Fri, Dec 9, 2011 at 1:23 AM, Roy Smith wrote: > I just spent a while beating my head against this one. > > # Python 2.6 a, b = 'foo' > Traceback (most recent call last): >  File "", line 1, in > ValueError: too many values to unpack Definitely weird! I smell a job for a linter though. If

Re: Misleading error message of the day

2011-12-08 Thread Andrea Crotti
On 12/08/2011 02:23 PM, Roy Smith wrote: I just spent a while beating my head against this one. # Python 2.6 a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should hav

Misleading error message of the day

2011-12-08 Thread Roy Smith
I just spent a while beating my head against this one. # Python 2.6 >>> a, b = 'foo' Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack The real problem is that there's too *few* values to unpack! It should have been a, b = 'foo', 'bar' I understan