Pēcis Beisikāns' Journal
View:Personal Journal.
View:Friends.
View:Calendar.
Missed some entries? Then simply jump to the previous day or the next day.

Monday, November 12th, 2007

Time:12:04 pm.
Poll #13271 list comprehensions vs. funkcionālais stils
Open to: All, results viewable to: All

Par kuru koda fragmentu tev ir vieglāk pateikt, ko tas dara un kāds būs rezultāts?

View Answers

a = [i for i in lst if i > 42]
13 (81.2%)

a = filter(lambda x: x > 42, lst)
3 (18.8%)



(Pieņemt ka lst = [50,1,60,2,70,3])
Sīkāk par lambda un funkcionālajiem frīkiem: http://hupp.org/adam/weblog/2007/11/10/python-lambda-shorthand/
Comments: Read 8 or Add Your Own.

Pēcis Beisikāns' Journal

View:User Info.
View:Friends.
View:Calendar.
View:Memories.
Missed some entries? Then simply jump to the previous day or the next day.