3 ms·
True. I think it might also be generally possible to pull a mapping function and a filtering function out of any list comprehension or generator expression. Tha
by etal 19y ago
True. I think it might also be generally possible to pull a mapping function and a filtering function out of any list comprehension or generator expression. That helps with debugging, too, without hurting performance:
def crazy_mapping(var): ...
def crazy_filter(var): ...
foo = [crazy_mapping(b) for b in bar if crazy_filter(b)]