r/ProgrammerHumor • • 16d ago

Meme whoWouldHaveThought

Post image
5.7k Upvotes

626 comments sorted by

View all comments

Show parent comment

8

u/KCGD_r 16d ago

to be fair, [1,3,5,7] has 7 makes the same amount of sense. Every language has weird paradigms, "in" isnt meant to be used with arrays, but it works anyway just due to how the language is structured. IMO it should error which would solve this exact case, but technically there is nothing wrong semantically, so it just gives you an answer.

0

u/da_Aresinger 16d ago

Tom is in the band. The band has a drummer.

A drummer is in the band. The band has Tom.

One works infinitely better than the other.

0

u/Sheerkal 16d ago

That literally exactly what is being criticized. You should not run into situations like this.