[python-users] Was Kapput?

Edward Dale scompt at scompt.com
Sa Jun 6 13:56:19 CEST 2009


Anscheinend liefert map() ein iterator in Python 3.0 statt ein list.
Sehe http://www.artima.com/weblogs/viewpost.jsp?thread=98196.

b=list(map(lambda x:x,[1,2,3,4,5]))

funktioniert es wie erwartet.

Grüße,
Edward

2009/6/6 Dirk Hünniger <do_not_reply_to_this_address at t-online.de>:
> Moin,
> irgendwas kommt mir hier spanisch vor. Python 3.0 liefert nicht das
> Ergebnis was ich erwarte.
> wenn ich die Zeile nach
> b=[1,2,3,4,5]
> ändere ist wieder alles Ok. Aber das will ich nicht.
> Gruß Dirk
>
> b=map(lambda x:x,[1,2,3,4,5])
> x=iter(b)
> print( next(x))
> y=iter(b)
> print( next(y))
>
> """
> output:
> 1
> 2
>
> expected:
> 1
> 1
> """
> ________________________________________
> Diese Mail erhalten Sie ueber die Mailingliste Python-users der Universitaet zu Koeln
> Python-users at uni-koeln.de
> https://lists.uni-koeln.de/mailman/listinfo/python-users
>



-- 
Edward Dale
eddale at cs.unc.edu
(919) 962-1729




Mehr Informationen über die Mailingliste python-users