good_smell icon indicating copy to clipboard operation
good_smell copied to clipboard

Move map to Iterator

Open Tadaboody opened this issue 7 years ago • 1 comments

New smell

Smelly code

for x in seq:
    a = transform(x)
    # Only use a or transform(x)

Fixed code

for a in (transform(x) for x in seq):
    # Only use a or transform(x)

Needs to be compatible with the rest of the smell fixes, especially #6

Tadaboody avatar Nov 29 '18 21:11 Tadaboody

This is proving harder than expected, not sure how to do it without subclassing the AST module with things like parent-pointers, which seems costly both in runtime and refactoring

Tadaboody avatar Jan 03 '19 18:01 Tadaboody