Tag: patterns
-
Do you enumerate?

Simple is better than complex. Zen of Python. You know that, right?Well, we all do, but it’s less consensual when it comes to enumerate(). “What is enumerate()?” In a nutshell, it’s a function that returns something similar to a list of index-value pairs*. It is mostly used in for loops to iterate over a list…
-
“Range len”, the anti-pattern

One step further on the way of Python: don’t count to get, just get. A common anti-pattern used by Python beginners is the “range len” pattern. I’m pretty sure you already encountered this anti-pattern in the past, and there is even a high probability that you have done it yourself. I did too ! Anti-pattern…