On Tuesday, August 16, 2016 at 6:26:01 PM UTC+12, Paul Rudin wrote: > sohcahtoa82 writes: >> squared_plus_one_list = map(lambda x: x**2 + 1, some_list) > > I realise that this is about understanding lambda, but it's worth noting > in passing that we tend to write this sort of thing as: > > squared_plus_one_list = [x**2 + 1 for x in some_list]
The difference being that the “map” function takes an iterable and returns an iterator. Why could this difference be important? -- https://mail.python.org/mailman/listinfo/python-list