Pydon'ts

Write elegant Python code

A series of articles that teaches you how to make the best use of the core Python features. The Pydon'ts are available as an e-book that you can read for free below.

This article covers the basics of sequence slicing in Python and teaches you some idiomatic slicing patterns to write more elegant code.

A short article with all you need to know about sequence indexing in Python – and a bit more.

If you need to access the items of an iterable but also keep track of their indices, have you considered using enumerate? Let's talk about another of Python's amazing tools to work with for loops.