This guide is part of a series on some of the more advanced features of Python, and specifically CircuitPython. Are you new to using CircuitPython? No worries, there is a full getting started guide here.
Adafruit suggests using the Mu editor to edit your code and have an interactive REPL in CircuitPython. You can learn about Mu and its installation in this tutorial.
CircuitPython gets far more interesting when used with the new SAMD51 (M4) based boards and the Raspberry Pi. Not only do they have much higher clock speeds, they also have much more RAM. CircuitPython programs run significantly faster as a result, and they can be much larger and/or work with much more data. With this space comes the capability to move beyond simple scripts to more elaborate programs.
The goal of this series of guides is to explore Python's mechanisms and techniques that will help make your more ambitious CircuitPython programs more manageable, understandable, and maintainable.
In CircuitPython 101: Basic Builtin Data Structures we learned about Python's list data structure. We saw how to manipulate them and how to create literal instances.
In CircuitPython 101: Functions we learned about lambdas, which are single expression functions that don't have a name assigned to them.
In this guide we'll explore some features of Python for working with lists: some list processing functions and list comprehensions. Then we'll go beyond simple lists with iterators and generators.
Text editor powered by tinymce.