[Microbit-Python] Towards a 1.0

Damien George damien.p.george at gmail.com
Mon Jan 18 07:51:12 EST 2016


Hi Marc,

Just now replying to your email from last week:

> These are some things I found while playing with the MicroPython
> (so far):
>
> * Printing in the Python script will have the output show
>   up on the console. This doesn't seem to be documented
>   anywhere, but is very useful for debugging scripts.

This is a very basic thing, so basic that I don't know where it should
be documented..!

> * Bug: microbit.Image() does not take keyword arguments
>   http://microbit-micropython.readthedocs.org/en/latest/image.html

Most functions/constructors/methods don't take keyword arguments, just
positional.

> * array only supports .extend() and .append()

What were you missing?

> * arrays don't support buffer protocol

Can you be more specific?  You can pass an array where a buffer is expected.

> * bytearray.extend() doesn't support iterators, only buffers

True.

> * bytearrays don't support slice assignment, only index
>   assignment

This feature was recently added upstream but it's not available in the
microbit version (yet...).

> * If you first run:
>   microbit.display.animate(i, 100, stride=1, wait=False, loop=True)
>   and then:
>   microbit.display.animate(i, 100, stride=1)
>   you get a deadlock.
>   There's no way to stop the background animation.

We need to fix this.

> * need an API to query the available memory on the heap; useful
>   for debugging memory leaks, but also to prevent MemoryErrors
>   from crashing your script

This exists, try:

import micropython
micropython.mem_info(1)

Cheers,
Damien.


More information about the Microbit mailing list