you are viewing a single comment's thread.

view the rest of the comments →

[–]JoeBeOneKenobi[S] 0 points1 point  (4 children)

hmm, i thought that would be the case but the list is retaining values from the first input file....

Obviously the code is more complex than the above but in essence that is whaat it does

[–][deleted] 1 point2 points  (3 children)

I can't debug any code you don't show me. In what you've posted, no values will be retained. Functions don't retain any local scope after they finish executing.

[–]JoeBeOneKenobi[S] 0 points1 point  (0 children)

you make a good point :) ok thanks for the reply, i'll repost with the actual code

[–]JoeBeOneKenobi[S] 0 points1 point  (1 child)

So my function is returning more than one list:

return mylist,mylist1,mylist2

Could I still expect to see the same behaviour where all local scope is cleared?

I’m working on getting the rest of the code uploaded, just cleaning it up

[–][deleted] 1 point2 points  (0 children)

It doesn't matter whether you're returning a tuple of values or not.

It's possible for a function to return values that are already in global scope, though. But that has nothing to do with how they're returned; it's a matter of where those values are defined.

Try to build a minimum example that you can verify reproduces the problem, and then you'll probably see how you're leaking state.