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

Chris Angelico rosuav at gmail.com
Tue Jun 3 13:08:57 EDT 2014


On Wed, Jun 4, 2014 at 2:49 AM, Paul Sokolovsky <pmiscml at gmail.com> wrote:
> 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.
>

With that encouragement, I just cloned your repo and built it on amd64
Debian Wheezy. Works just fine! Except... I've just found one fairly
major problem with your support of Python 3.x syntax. Your str type is
documented as not supporting Unicode. Is that a current flaw that
you're planning to remove, or a design limitation? Either way, I'm a
bit dubious about a purported version 1 that doesn't do one of the
things that Py3 is especially good at - matched by very few languages
in its encouragement of best practice with Unicode support.

What is your str type actually able to support? It seems to store
non-ASCII bytes in it, which I presume are supposed to represent the
rest of Latin-1, but I wasn't able to print them out:

Micro Python v1.0.1-144-gb294a7e on 2014-06-04; UNIX version
>>> print("asdf\xfdqwer")

Python 3.5.0a0 (default:6a0def54c63d, Mar 26 2014, 01:11:09)
[GCC 4.7.2] on linux
>>> print("asdf\xfdqwer")
asdfýqwer

In fact, printing seems to work with bytes:

>>> print("asdf\xc3\xbdqwer")
asdfýqwer

(my terminal uses UTF-8, this is the UTF-8 encoding of the above string)

I would strongly recommend either implementing all of PEP 393, or at
least making it very clear that this pretends everything is bytes -
and possibly disallowing any codepoint >127 in any string, which will
at least mean you're safe on all ASCII-compatible encodings.

ChrisA



More information about the Python-list mailing list