Is there a substantial difference in Python 3.x between:
for each_line in data_file:
if each_line.find(\":\") != -1:
#placeholder for code
As I understand it,
functionally they are not entirely the same; if you are comparing against a class, the class could have a member function, __ne__
which is called when using the comparison operator !=, as opposed to __eq__
which is called when using the comparison ==
So, in this instance,
not (a == b)
would call __eq__
on a, with b as the argument, then not
the result
(a != b)
would call __ne__
on a, with b as the argument.
I would use the first method (using !=) for comparison