Micro Python -- a lean and efficient implementation of Python 3

Paul Sokolovsky pmiscml at gmail.com
Tue Jun 3 12:49:49 EDT 2014


Hello,

On Tue, 3 Jun 2014 23:11:46 +1000
Chris Angelico <rosuav at gmail.com> wrote:

> On Tue, Jun 3, 2014 at 10:27 PM, Damien George
> <damien.p.george at gmail.com> wrote:
> > - Supports almost full Python 3 syntax, including yield (compiles
> > 99.99% of the Python 3 standard library).
> > - It supports a growing subset of Python 3 types and operations.
> > - Part of the Python 3 standard library has already been ported to
> > Micro Python, and work is ongoing to port as much as feasible.
> 
> I don't have an actual use-case for this, as I don't target
> microcontrollers, 

Please let me chime in, as one of MicroPython contributors. I also
don't have immediate usecase for a Python microcontroller (but seeing
how fast industry moves, I won't be surprised if in half-year it will
seem just right). Instead, I treat MicroPython as a Python
implementation which scales *down* very well. With current situation in
the industry, people mostly care about scaling up - consume more
gigabytes and gigahertz, catch more clouds and include heavier and
heavier batteries.

MicroPython goes another direction. You don't have to use it on a
microcontroller. It's just if you want/need it, you'll be able - while
still staying with your favorite language.

I'm personally interested in using MicroPython on a small embedded
Linux systems, like home routers, Internet-of-Thing devices, etc. Such
devices usually have just few hundreds of megahertz of CPU power, and
2-4MB of flash. And to cut cost, the lower bound decreases all the
time.

> but I'm curious: What parts of Py3 syntax aren't
> supported? And since you say "port as much as feasible", presumably
> there'll be parts that are never supported. Are there some syntactic
> elements that just take up way too much memory?

Syntax-wise, all Python 3.3 syntax is supported. This includes things
like yield from, annotations, etc. For example:

$ micropython 
Micro Python v1.0.1-139-g411732e on 2014-06-03; UNIX version
>>> def foo(a:int) -> float:
...     return float(a)
... 
>>> foo(4)
4.0


"99.9%" statement is due to fact that there were some problems parsing
couple of files in CPython 3.3/3.4 stdlib.

Note that above talks about syntax, not semantics. Though core
language semantics is actually now implemented pretty well. For
example, "yield from" works pretty well, so asyncio could work ;-).
(Except my analysis showed that CPython's implementation is a bit
bloated for MicroPython requirements, so I started to write a
simplified implementation from scratch).


As can be seen from the dump above, MicroPython perfectly works on a
Linux system, so we encourage any pythonista to touch a little bit of
Python magic and give it a try! ;-) And we of course interested to get
feedback how portable it is, etc.

(As a side note, it's of course possible to compile and run MicroPython
on Windows too, it's a bit more complicated than just "make".)

> 
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com



More information about the Python-list mailing list