I have a list a = [1,2,3,4,5]
. And I have a function, say, Func(x)
. I know that if I do Func(a)
then the reference of a
will be passed into Func(x)
. And if I do Func(a[:])
, a new list will be created and passed into Func(x)
.
So my question is: Is it possible to only pass the first three elements into Func(x)
by reference, like Func(a)
(I don't want to pass the whole list a
into function due to certain reason)? If I do Func(a[:4])
a new list will be created and that's what I want to avoid.
The only way I can think about is to pass a
and the indexes into Func(x)
, like Func(a, start, end)
.