r/ProgrammerAnimemes • • May 29 '22

Fixed that certain meme about python

Post image
1.1k Upvotes

59 comments sorted by

View all comments

Show parent comment

1

u/Mast3r_waf1z May 30 '22

Sure I know what list comprehension is, for reference i primarily use python myself, but you're just using a built-in function which could have been expressed in a more readable format as you've literally shown yourself

I've had a lot of classmates get very confused by a long comprehension where I've had to rewrite it as a normal for loop to explain it

The nly real advantages I can see from using comprehension is it's speed as I'm pretty sure it is compiled as a single line and that it is easier to pass to numpy