Vex Python Version

Does anybody know what version of Python Vex V5 code can run (i.e. 3.12) ? If it’s 3rd party, what version does it simulate and/or what version does it mirror?

The Python VM is a program that runs on the brain, it’s based on micropython 1.13 with several changes we add.
https://docs.micropython.org/en/v1.13/

3 Likes

On Wikipedia, it says:

Although MicroPython fully implements Python language version 3.4 and much of 3.5, it does not implement all language features introduced from 3.5 onwards, though some new syntax from 3.6 and more recent features from later versions, e.g. from 3.8 (assignment expressions) and 3.9.

However, the enumerator function is in the 3.0 python documentation (likely introduced in 3.0), but is not built-in for our VEX brain. I did get around the situation, but, out of curiosity, does the VEX Brain not have some of the built-in functions for Python? Thanks.

enumerator is not enabled.

When configuring a micropython build, there is a large configuration file that determines, along with the makefile, which parts are included. The more things included, the larger the binary. The initial commit of this project for the V5 was in Dec 2019, but that was based on some feasibility work I had done as early as 2016 when we considered using it on IQ generation 1, the configuration was probably setup at that time.

Anyway, this is what is enabled for the so called “builtin” modules, just a snippet from the full config file.

#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
#define MICROPY_PY_BUILTINS_DICT_FROMKEYS (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
#define MICROPY_PY_BUILTINS_FILTER  (0)
#define MICROPY_PY_BUILTINS_FROZENSET (0)
#define MICROPY_PY_BUILTINS_REVERSED (1)
#define MICROPY_PY_BUILTINS_SET     (1)
#define MICROPY_PY_BUILTINS_SLICE   (1)
#define MICROPY_PY_BUILTINS_PROPERTY (1)
#define MICROPY_PY_BUILTINS_MIN_MAX (1)
#define MICROPY_PY_BUILTINS_STR_COUNT (1)
#define MICROPY_PY_BUILTINS_STR_OP_MODULO (1)

you can see enumerate is disabled. I will see what enabling it does for the next rev, probably no downside.

The new AIM product will use a VM based on micropython 1.22, at some stage I may update V5, but there have been many breaking changes to APIs in micropython between the 1.13 and 1.22 versions, it would be significant work to update everything.

4 Likes