The Python programming language's flexibility and ease-of-use have made it popular in many realms where speed of development is more important than raw performance. Now a new variant for embedded applications has emerged, one created in conjunction with a hardware project designed to show off what's possible with Python in such environments.
The Micro Python variant of Python 3 is a from-scratch reimplementation of the language in C, not simply a port of the original CPython implementation of Python. According to the Kickstarter page originally used to bootstrap the project, it includes "a complete parser, compiler, virtual machine, runtime system, garbage collector, and support libraries to run on a microcontroller." Code compiles and runs directly on the microcontroller, not on a host PC.
While Micro Python supports a broad range of the language features of both Python 2 and 3, some features are still missing. For instance, Unicode support for strings hasn't been implemented yet. But unlike CPython, Micro Python can output native machine code as well as conventional Python bytecode, and it can include assembly code inline, which is important to programmers of embedded controllers.
Right now, the language is targeted at 32-bit ARM processors that use the Thumb v2 instruction set. To that end, the project's creator, Damien George, a theoretical physicist at the University of Cambridge, has created just such a board using the STM32F405 processor. Backers of the Kickstarter project have already received early versions of the boards.
Python's become one of the most popular dynamic languages, even as it's received criticism for being slower than C/C++ or Java. Consequently, it might seem might seem an odd choice for embedded applications. But the language's inventor, Guido van Rossum, has argued that the faster pace of development permitted by Python provides its own speed-up and the more speed-critical portions of an application can be coded separately. Micro Python has provisions for such separate coding, so it ought to be interesting to see whether it achieves traction more with existing Python developers or with hardware hackers.
This story, "Micro Python's tiny circuits: Python variant targets microcontrollers," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.