tt = a, b = t

rihad rihad at mail.ru
Sun Jan 13 23:24:43 EST 2002


On Sun, 13 Jan 2002 22:46:35 +0400, rihad <rihad at mail.ru> wrote:

>Playing with Python goes on....
>
>tup = 1, 2
>tuptup = a, None = tup
>
>>>> tup
>(1, 2)
>>>> a
>1
>>>> tuptup
>(1, 2)
>
>How did 2 manage to propagate to tuptup through None?

OK, so None is a variable... what I /expected/ from assignment to None
was not unlike this perlism:

  my ($a, undef, $b) = $_;

That is, undef takes up that slot to make the compiler happy, but I'm
not really interested in $_[1].

Obviously, I have to learn to think /differently/ in Python.




More information about the Python-list mailing list