McA wrote:
Do you know the "protocol" used by python while unpacking?
Is it a direct assingnment? Or iterating?
In CPython, at least, both, just as with normal unpack and multiple
assignment. The iterable is unpacked into pieces by iterating (with
knowledge of the number of targets and wh
McA wrote:
On 17 Jul., 18:33, Gary Herron <[EMAIL PROTECTED]> wrote:
In Python 2.x, you can't do that directly, but you should be able to
create a function that lengthens or shortens an input tuple of arguments
to the correct length so you can do:
a,c,b = fix(1,2)
d,e,f = fix(1,2,3,4)
H
On 17 Jul., 18:33, Gary Herron <[EMAIL PROTECTED]> wrote:
>
> In Python 2.x, you can't do that directly, but you should be able to
> create a function that lengthens or shortens an input tuple of arguments
> to the correct length so you can do:
>
> a,c,b = fix(1,2)
> d,e,f = fix(1,2,3,4)
>
> Ho
McA wrote:
Hi all,
probably a dumb question, but I didn't find something elegant for my
problem so far.
In perl you can unpack the element of a list to variables similar as
in python
(a, b, c = [0, 1, 2]), but the number of variables need not to fit the
number
of list elements.
That means, if yo
Hi all,
probably a dumb question, but I didn't find something elegant for my
problem so far.
In perl you can unpack the element of a list to variables similar as
in python
(a, b, c = [0, 1, 2]), but the number of variables need not to fit the
number
of list elements.
That means, if you have less l