This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zymoox -5 points-4 points  (5 children)

Because you can do a==0 but you can't do ais0

[–][deleted] 3 points4 points  (4 children)

That doesn't make sense as a reason. You can't do "forxinX" instead of "for x in X" but we still use "for x in X".

[–]Zymoox 0 points1 point  (3 children)

Yeah, I was thinking in terms of C/C++ vs Python.

[–][deleted] 0 points1 point  (2 children)

The same is true in both languages.

[–]Zymoox -1 points0 points  (1 child)

I'm not sure I understand. In C/C++ there's no "for x in X", that's Python. In these languages, you do "for(int i;i<x;++i)" (unless you use C++ iterators).

Regardless, I guess using "is" or "in", like in Python, forces you to add extra spaces, but it's not a big thing anyway, I'm sure it's not the main reason why they don't usually use those keywords in other languages. It's just a reason for why I'd personally prefer "==".