Jan-15-2022, 06:59 PM
i have a function that is given a list and it stores a special value into the first position (index 0) of that list.
i do have a real use case for this, which is more complicated, but, i prefer to work with a minimal example case, to determine a more general use solution.
def store_special_value(where_to_store): ... if isinstance(where_to_store,list): where_to_store[0] = special_value returni want to call that function and put that value into the n-th element a list:
def main(args) ... target = [] ... temp_list = [None] store_special_value(temp_list) target[n] = temp_list[0] ...my question is: is there a more direct way to do this without using the temporary list? that would mean a list reference that refers to a subset of an existing list (target) but operates as if it were a whole list. list slicing creates a new list instead of referring to an existing given list, so that is not a solution. is there a way to make a subset reference like that?
i do have a real use case for this, which is more complicated, but, i prefer to work with a minimal example case, to determine a more general use solution.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.