[Microbit-Python] A request for help... fancy designing a Pythonic API that up to 1 million kids would use..?

David Whale david at thinkingbinaries.com
Fri Aug 28 21:00:24 CEST 2015


Nicholas,

I'd be interested in reviewing the API spec proposals when they are done
(naming and containership of namespaces, parameters etc).

Just one point. I'd like to propose that there is significant value in
using *exactly* the same names as are already used in the TouchDevelop API,
with exactly the same groupings. There's been a lot of work recently to
consolidate the TouchDevelop, Blocks [and to some extent CodeKingdoms]
vocabulary for things, so that it is a mostly seamless experience to move
from one language to another, with the transferrable knowledge of the
common micro:bit API tying everything together.

Please do look back at the TouchDevelop, there have been a number of
commits to the live site in the last week or two with changes to default
namespaces, some additional 'standard' linked in libraries like bits, game,
and events, some name changes, and stuff like that. system_time() for
example is not one of the vocabulary words in use in the live system, it
has been renamed a few times and has settled now on "running time".

I don't think we should get too hung up on it being "Pythonic", as long as
it is 'Python'.

David

___________________________________________________________
David Whale, B.Sc (Hons), MIET
*Software Engineer and IET Schools Liaison Officer, Essex*

email:  dwhale at theiet.org
twitter: @whaleygeek
blog:  blog.whaleygeek.co.uk

Co-author of the new book "Adventures in Minecraft" <http://amzn.to/ZGfxZG>
- lets get kids coding!


On 28 August 2015 at 16:08, Nicholas H.Tollervey <ntoll at ntoll.org> wrote:

> Hi Folks,
>
> Although this list has been a tad quiet recently, things are moving
> along when it comes to Python on the micro:bit.
>
> The "blessed" device abstraction layer (DAL) created by Lancaster
> University for the BBC to use with the micro:bit is now working with
> MicroPython.
>
> What we need to do is create a Pythonic "microbit" module that gives
> users of Python direct access to the device hardware via the DAL.
>
> In terms of the work, this is simply a task of code-plumbing. However,
> the challenge will be in creating something that is Pythonic and easy
> enough for the nation's 11yo to get their heads around. That means
> obvious mono-syllabic names and shallow namespaces while still retaining
> the "shape" of the DAL.
>
> So, I'm going to start writing some documentation about the various
> features that the DAL exposes and both Damien and I would like help in
> designing the API (since actually coding it is a relatively simple task
> of connecting Python to the DAL). It's definitely a case of more eyes
> will make this better.
>
> In case you're wondering, we already have made a start. So for example,
> here's the output from MicroPython's help() function:
>
> >>> help()
> Welcome to MicroPython on the micro:bit!
>
> Be brave! Break things! Learn and have fun! :-)
>
> Type 'import microbit', press return and try these commands:
>   microbit.display.scroll('Hello')
>   microbit.system_time()
>   microbit.sleep(1000)
>   microbit.button_a.is_pressed()
> What do these commands do? Can you improve them? HINT: use the up and
> down arrow keys to get your command history (saves you typing).
>
> Explore:
> Type 'help(something)' to find out about it. Type 'dir(something)' to
> see what it can do.
>
> Stuff to explore:
>   microbit.accelerometer         -- detect the device's position
> (orientation)
>   microbit.button_a.is_pressed() -- is button A pressed? (True or False)
>   microbit.button_b.is_pressed() -- is button B pressed? (True or False)
>   microbit.compass               -- detect the device's heading
>   microbit.display               -- display things (pixels, characters,
> words)
>   microbit.panic()               -- go into panic mode (requires a restart)
>   microbit.random(n)             -- get a random number between 0 and n
>   microbit.sleep(n)              -- wait for n milliseconds (1 second =
> 1000)
>   microbit.system_time()         -- get the number of milliseconds since
> reset
>
> Control commands:
>   CTRL-C        -- stop a running program
>   CTRL-D        -- on a blank line, do a soft reset of the micro:bit
>
>
> The only major part of the DAL we've not already started to reference is
> the IO namespace for accessing the pins along the bottom of the device.
>
> Pretty much all of the above namespaces have things missing or clunkily
> named.
>
> So, fancy helping 1 million kids learn and play with Python? You will be
> given credit in the code and perhaps an easter egg I have in mind. ;-)
>
> Let me know your thoughts!
>
> Best wishes,
>
> Nicholas.
>
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/mailman/private/microbit/attachments/20150828/8577f281/attachment.html>


More information about the Microbit mailing list