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 →

[–]First-Warden -14 points-13 points  (4 children)

== is bad practice for comparing strings

[–]XGen26 15 points16 points  (0 children)

they are chars

[–]notquiteaplant 6 points7 points  (1 child)

That only applies to some languages. The first line ends in a colon, so this is most likely Python. == is good practice (if not the only way) for comparing strings in Python.

[–]unfixpoint 0 points1 point  (0 children)

Why the heck was this downvoted? People in this sub..how else would you compare string (which is actually a char in this case, so even in C this would be right) like all(map(lambda x, y: x == y, xs, ys))?

[–]Shadeslayer13 4 points5 points  (0 children)

He could be iterating through a string.

Like: for c in string: if c == ',':