summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_subscr.py
blob: bcaabd3fb409b97345f6d8bf6944793bdd395762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# test standard Python subscr using viper types


@micropython.viper
def get(dest, i: int):
    i += 1
    return dest[i]


@micropython.viper
def set(dest, i: int, val: int):
    i += 1
    dest[i] = val + 1


ar = [i for i in range(3)]

for i in range(len(ar)):
    set(ar, i - 1, i)
print(ar)

for i in range(len(ar)):
    print(get(ar, i - 1))