Closed adeuring closed 3 months ago
Oh, similar things happen for dicitonaries and sets defined in a setup function:
d = {
'a': 42,
'b': 43,
1: 44}
print(d)
s = {
'a',
'b',
'c',
}
print(s)
gives this output:
{0: 43, 1: 44}
{0}
Found a workaround: Define the list in a function nested inside the setup function:
@device.setup
def setup():
def make_list():
return [
'a1', 'a2',
'b1', 'b2',
]
l = make_list()
print(l)
Result:
['a1', 'a2', 'b1', 'b2']
Hi @adeuring! Thank you for opening this issue; I am able to reproduce in my setup. There is a bug in my code-minifying function. Investigating now!
Fixed in v0.22.4
Wow, thanks, that was really fast!
The title may sound odd but the following script gives really weird output:
Result:
So, the first string in a line is replaced with the integer 0. Seen with Belay 0.22.3 and Micropython v1.20.0 on an ESP32.
The error does not occur in a task.