[Microbit-Python] Flat API

David Whale david at thinkingbinaries.com
Tue Sep 22 10:48:27 CEST 2015


Yes, I think it already talks about dir() in the help() text - or if it
doesn't, I know Nicholas was going to add that along with a possible
help(modules), as we were all very keen that a lot of the libraries could
be discovered by exploration alone.

D


___________________________________________________________
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 22 September 2015 at 09:15, Tom Viner <tom at viner.tv> wrote:

> On 22 September 2015 at 06:37, David Whale <david at thinkingbinaries.com>
> wrote:
>
>> "from microbit import *"
>
>
> I can see the benefit of "from microbit import *" to chop the namespace by
> one level (and 9 characters per go) since *there is only one module* but
> since you can't then do microbit.<tab> you absolutely need to ensure people
> have a way of knowing what they just imported.
>
> Two possible ways of doing that:
> - emphasise even further the ability to do dir() to see what's in your
> namespace. I recommend terminal colouring to highlight the help message at
> repl start time.
> - if we're willing to break with normal python: import * could output a
> help message to stderr listing the names of the items imported. That would
> be the student friendly approach.
>
> Finally, regardless of our preference, some people will indeed use, "from
> microbit import *" so we must ensure that all microbit.* items don't clash
> with builtins and - for the future - std library module names.
>
>
> _______________________________________________
> 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/20150922/e1843bbd/attachment.html>


More information about the Microbit mailing list