The code below runs fine on CPython (versions 2.7.16, 3.4.10, 3.7.0, ...), but produces a "TypeError" on MicroPython (ESP32 firmware esp32-idf3-20200618-unstable-v1.12-554-gce02d5e34):
Code: Select all
class Cfg(dict):
def __init__(self, default={}):
self.update(default)
cfg = Cfg(default={"rate": 30})
print(cfg)
Code: Select all
{'rate': 30}
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "<stdin>", line 3, in __init__
TypeError:
>>>
Is there any suggested workaround?
Thanks!