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
"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
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
"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
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?
> 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
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
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
_
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
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
10 matches
Mail list logo