[Microbit-Python] Accessor API design on the micro:bit

Damien George damien.p.george at gmail.com
Tue Nov 3 10:45:30 EST 2015


> Well, again, technically, right now the act of reading the device is done asynchronously in the idle thread.  Directly interacting with the "accelerometer" object doesn't cause a read.

No, calling "get_x()" does actually cause a read on the I2C bus if the
accelerometer is not "up to date".

Regarding "variables".  As Michael points out, accelerometer.x is not
really a variable in the sense that the kids will learn, because 1)
you can't change it; 2) it changes by itself.  So I'd say that .x as a
property is a much more sophisticated concept than a traditional
variable or a function.

In our current API everything without parenthesis is a fixed entity.
Eg microbit.pin0, Image.HEART.  And everything with parenthesis at the
end is a function call that does something or interacts with the real
world.


More information about the Microbit mailing list