Re: [Tutor] Unexpected iterator

2009-11-16 Thread Kent Johnson
On Mon, Nov 16, 2009 at 12:17 AM, spir wrote: > Le Sun, 15 Nov 2009 19:23:33 -, > "Alan Gauld" s'exprima ainsi: > >> What does 'unpack' mean?  I've seen a few Python errors about packing >> and unpacking.  What does it mean? > > Unpacking is rarely needed. It matches some kind of problems. N

Re: [Tutor] Unexpected iterator

2009-11-16 Thread Alan Gauld
"spir" wrote Unpacking is rarely needed. It matches some kind of problems. ... (parens not needed) It's just an elegant manner to avoid indexing -- right? Regarding tuple unpacking... Absolutely, its a convenience. Regarding struct unpacking, its an absolute necessity in getting data out

Re: [Tutor] Unexpected iterator

2009-11-15 Thread spir
Le Sun, 15 Nov 2009 19:23:33 -, "Alan Gauld" s'exprima ainsi: > What does 'unpack' mean? I've seen a few Python errors about packing > and unpacking. What does it mean? Unpacking is rarely needed. It matches some kind of problems. Imagine you parse "codes" each made of name-sep-number. T

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Alan Gauld
"Stephen Nelson-Smith" wrote To upack your variables a and b you need an iterable object on the right side, which returns you exactly 2 variables What does 'unpack' mean? I've seen a few Python errors about packing and unpacking. What does it mean? It has a coup[le of uses, the one being

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Alan Plum
On So, 2009-11-15 at 15:12 +, Stephen Nelson-Smith wrote: > > To upack your variables a and b you need an iterable object on the right > > side, which returns you exactly 2 variables > > What does 'unpack' mean? I've seen a few Python errors about packing > and unpacking. What does it mean?

Re: [Tutor] Unexpected iterator

2009-11-15 Thread Stephen Nelson-Smith
> To upack your variables a and b you need an iterable object on the right > side, which returns you exactly 2 variables What does 'unpack' mean? I've seen a few Python errors about packing and unpacking. What does it mean? S. ___ Tutor maillist - T

Re: [Tutor] Unexpected iterator

2009-11-12 Thread Dave Angel
Jeff R. Allen wrote: Hello, I am working my way through the tutorial, and I like trying variations, just to see what expected errors look like, and other ways things could be written. I tried a, b = 0, 0 and that worked. Then I tried this to (maybe) set both a and b to 0: a, b = 0

Re: [Tutor] Unexpected iterator

2009-11-12 Thread Sander Sweers
2009/11/12 Jeff R. Allen : > Then I tried this to (maybe) set both a and b to 0: > a, b = 0 > Traceback (most recent call last): >  File "", line 1, in > TypeError: 'int' object is not iterable I think you are looking for. >>> a = b = c = 300 Greets Sander _

Re: [Tutor] Unexpected iterator

2009-11-12 Thread Patrick Sabin
Jeff R. Allen wrote: a, b = 0 Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is not iterable I understand why it doesn't work, but I don't understand the wording of the exception. Could someone explain how I accidentally introduced iteration into the picture

[Tutor] Unexpected iterator

2009-11-12 Thread Jeff R. Allen
Hello, I am working my way through the tutorial, and I like trying variations, just to see what expected errors look like, and other ways things could be written. I tried a, b = 0, 0 and that worked. Then I tried this to (maybe) set both a and b to 0: >>> a, b = 0 Traceback (most recent call la