Code: Select all
from micropython import const
class a(object):
test = const(0x1)
class b(object):
test = 0
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 4, in b
SyntaxError: can't assign to expression
It is a global variable, but it is also a class member constant. Why does it affect member variables of other classes?Constants declared this way are still accessible as global variables from outside the module they are declared in.