list-display semantics?

Roman Suzi rnd at onego.ru
Sun Jun 10 20:50:47 CEST 2001


On Mon, 11 Jun 2001, jainweiwu wrote:

>Hi all:
>I tried the one-line command in a interaction mode:

Try:

del y
[x for x in [1, 2, 3], y for y in [4, 5, 6]]

>and the result surprised me, that is:
>[[1,2,3],[1,2,3],[1,2,3],9,9,9]
>Who can explain the behavior?
>Since I expected the result should be:
>[[1,4],[1,5],[1,6],[2,4],...]
>--
>Pary All Rough Yet.
>parywu at seed.net.tw
>
>
>

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Sunday, June 10, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Computers make very fast, very accurate mistakes." _/





More information about the Python-list mailing list