tt = a, b = t

rihad rihad at mail.ru
Mon Jan 14 05:24:43 CET 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