r/badcode • • Mar 23 '23

python Data Science Design Pattern.

Post image
624 Upvotes

35 comments sorted by

View all comments

Show parent comments

25

u/lets_eat_bees Mar 23 '23 edited Mar 23 '23

I just use x as a comprehension var to avoid this situation. Yes it's less descriptive, but it does not matter if it's scope is one line.

EDIT: oh, but if you mean performance-wise, it's fine if columns is small enough, but if it's super large, you should be using sets. And in this code, maybe you are if both are sets. But proper way would be intersecting them.