mpy-cross questions

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
Posts: 1769
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: mpy-cross questions

Post by jimmo » Sun Jan 05, 2020 11:56 pm

Code: Select all

>>> sys.path=['/', '/lib', '']
You can't override members of a built-in module. The definition of these modules is in ROM.

But as you've discovered, the member itself is a list, and therefore supports the insert method.
jedie wrote:
Sun Jan 05, 2020 6:44 pm
Seems that's hardcoded in ports/esp8266/qstrdefsport.h:
This is just the definition of the QSTR values that are stored in this list. It allows code elsewhere to write `mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_lib));` which is what actually defines the default value of sys.path.

Post Reply