Single line for loop over iterator with an "if" filter?
You could do:
for airport in filter(lambda x: x.is_important, airports):
# do stuff...
No, there is no shorter way. Usually, you will even break it into two lines :
important_airports = (airport for airport in airports if airport.is_important)
for airport in important_airports:
# do stuff
This is more flexible, easier to read and still don't consume much memory.