I’m having a python list preinitialized like this:
eventarray=[None]*10000
Is there any other way to preinitialize this list,so that 10000 can be a variable to be changed from different functions inside,without changing the data in the list.
Note:preinitialisation is done for inserting value on a particular offset of list.
From what I can infer from your question, you want to create a list with global scope, with its length determined at runtime.
Edit: The following code now extends the list as necessary each time my_list_creator is accessed:
foois global in scope, but is initialised as necessary.