0
 for data in main_data:
     data_to_write = calculateAnswer(data, pass_list, id)

In this "pass_list" I am sending same list [somedata] again and again (due to for loop)? Is there a better way to do this performance wise without declaring "pass_list" global?

Or should I just take the function and write it in the place where it is called. hopefully I have explained clearly.

Andy G
  • 19,232
  • 5
  • 47
  • 69
Dark Knight
  • 869
  • 1
  • 9
  • 18

1 Answers1

1

Yes, it's been shown and explained many times in stack that python passes in references in cases like these so the overhead is negligible. It's probably best to keep things simple and not use global vars like you said so I'd leave it as it is.

ZekeDroid
  • 7,089
  • 5
  • 33
  • 59