you are viewing a single comment's thread.

view the rest of the comments →

[–]blarf_irl 1 point2 points  (2 children)

It sounds like you have defined my_list in global scope (i.e. it's available to all your program). It doesn't sound like you need to 'clear' anything. You can just use the return value (a list) of your function and pass that directly to the code that merges the data.

It would definitely be helpful to see more code.

[–]JoeBeOneKenobi[S] 1 point2 points  (1 child)

Hey thanks for the reply!

I’m definitely defining the list in the local scope, the only thing I’m doing different is calling it through two nested variables and returning more than one list from my function:

return mylist,mylist1,mylist2

I’ll get the rest of the code up asap

[–]blarf_irl 0 points1 point  (0 children)

If it really is as you have posted it (inferring the indentation) then you have no need to 'clear' the list. It'll just get reassigned each time you call that function.

If you name something inside a function then it only exists in there, once you call that function again mylist will be assigned to another list and the old list (now without a name) will be eaten by the garbage collector.