O'Reilly logo

Programming with MicroPython by Nicholas H. Tollervey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Idiomatic MicroPython

The prior handful of chapters deal with many technical aspects of working with MicroPython: the modules you have available to you, how they interact with the hardware, and how various protocols can be used to make interesting and useful things happen. However, there has been no discussion of how to use such knowledge to create good code: code that is idiomatic MicroPython or, as some in the community like to say, Pythonic. To learn what this means, we need to take a step back and consider Python in terms of both language design and programming culture before looking into how best to write Pythonic MicroPython on highly constrained embedded devices.

Why is Python such a popular language? What motivates so many to contribute to the Python community? Why is Python widely used as a teaching language?

In the 1990s, Guido van Rossum, the creator of Python and the project’s Benevolent Dictator for Life (BDFL), used Python as the basis for a project called “Computer Programming for Everybody: A Scouting Expedition for the Programmers of Tomorrow”. The opening paragraphs of the project’s proposal provide one clue to Python’s popularity:

In the seventies, Xerox PARC asked: “Can we have a computer on every desk?” We now know this is possible, but those computers haven’t necessarily empowered their users. Today’s computers are often inflexible: the average computer user can typically only change a limited set of options configurable via a “wizard” (a lofty ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required