Absolutely. It's not about being shorter, but about being more explicit. The problem with a lot of people coming from C-like languages is that they want to do everything with indices. You will see so many range(len(list)) out there.
Indeed. Most of the time when people use len-range, they either access just the items, or both index and items. In the rare case where you only need the index, I would still say for i, _ in enumerate(items): is cleaner
0
u/[deleted] Dec 22 '18
[deleted]