I'm trying to understand how arrays work in Vyper. It seems that they always get copied on assignment. However, I found the following:
@public
def change_arr(arr: int128[5]):
a: int128[5] = arr
a[0] = 24
@public
def call_arr() -> int128:
a: int128[5]
a[0] = 42
self.change_arr(a)
return a[0]
As expected, calling the function call_arr returns 42. However, if I make the function change_arr private the execution ends in an exception (because of a[0] = 24).
I'm trying to understand how arrays work in Vyper. It seems that they always get copied on assignment. However, I found the following:
As expected, calling the function
call_arrreturns 42. However, if I make the functionchange_arrprivate the execution ends in an exception (because ofa[0] = 24).