21 Jul
2010
21 Jul
'10
1:12 a.m.
List comprehensions are the one place where I might find this useful. I can do this with map though: [y for x in another_list if y < 5 where y = f(x)] [y for x in map(f, another_list) if x < 5] [x for x in another_list if y < 5 where y = f(x)] [x for (x,y) in map(lambda x: (x,f(x)), another_list) if y < 5] I think the variant with 'where' or 'with' would be a bit more readable but is it valuable enough? --- Bruce http://www.vroospeak.com http://google-gruyere.appspot.com On Tue, Jul 20, 2010 at 7:57 AM, Andrey Popp <8mayday@gmail.com> wrote:
mylist = [y for y in another_list if y < 5 where y = f(x)]