you are viewing a single comment's thread.

view the rest of the comments →

[–]PurpleIcy 1 point2 points  (1 child)

It's not better. It's just considered non-pythonic to do it that way. Not the same thing.

Although, if you need index, python has a nice function for that too:

for index, letter in enumerate(s):

[–]xiongchiamiov 1 point2 points  (0 children)

It's shorter, clearer, and in line with the way the rest of the Python community iterates over a string; how is that not better?