title: How to get concurrent.futures ThreadPoolExecutor work with a dictionary as one of two params?
body: <p>I try to create a ThreadPoolExecutor with two params where one of them is a dictionary.
  My intention is to pass the whole dictionary as a param, but at the moment my <code>multi_thread_load</code> loads the first player_ID with the first dictionary value and the second player_ID with the second dictionary value.</p>
  <p>Is there a way to pass the whole dictionary as a param for each player_ID?</p>
  <p>My goal is to have a class for each player_ID which contains a player_dictionary with several attributes like position, club, name, goals, games played etc. which will all be collected in <code>get_base_data</code> and append the current league position of the club to the player_dictionary.</p>
  <p>One work around would be to implement the scraping of the clubs league position to <code>get_base_data</code> but then my code would scrape the website with the league position unnecessarily multiple times and I want to avoid that.</p>
  <h1>file Player.py</h1>
  <pre><code>class Player:
      def __init__(self, player_ID, ranks_dictionary):
          self.player_ID = player_ID
          self.club_ranks = ranks_dictionary
          self.player_dictionary = {}
          self.get_base_data()
          self.get_club_rank()
  
      def get_base_data(self):
          # do something with self.player_ID
          # and fill player_dictionary (Name, Club, Position, ...)
          pass
  
      def get_club_rank(self):
          # get the national league rank from given dictionary
          try:
              rank = self.club_ranks[self.player_dictionary[&quot;club&quot;]]
              self.dictionary[&quot;club_rank&quot;] = rank
          except:
              pass
  </code></pre>
  <h1>file Process.py</h1>
  <pre><code>import Player
  import concurrent.futures
  
  class Process:
      def __init__(self):
          self.dataset = []
          
      def create_player_class(self, player_ID, ranks_dictionary):
          player = Player.Player(player_ID, ranks_dictionary)
          self.dataset.append(player.dictionary)
  
      def multi_thread_load(self, given_set, club_ranks):
          # creates multiple player classes at once &amp; loads the data for those player
          max_thread = 25  # a higher number increases processing speed
          player_IDs = given_set
          ranks_dictionary = club_ranks
          threads = min(max_thread, len(player_IDs))
  
          with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor:
              executor.map(self.create_player_class, player_IDs, ranks_dictionary)
  </code></pre>
  <h1>execution file</h1>
  <pre><code>import Process
  
  dictionary = {
      &quot;FC Bayern München&quot;: &quot;1&quot;,
      &quot;Borussia Dortmund&quot;: &quot;2&quot;,
      &quot;RB Leipzig&quot;: &quot;3&quot;,
      &quot;Bayer 04 Leverkusen&quot;: &quot;4&quot;,
      &quot;Borussia M'gladbach&quot;: &quot;5&quot;,
      &quot;FC Augsburg&quot;: &quot;6&quot;,
      &quot;VfB Stuttgart&quot;: &quot;7&quot;,
      &quot;1. FC Union Berlin&quot;: &quot;7&quot;,
      &quot;SV Werder Bremen&quot;: &quot;9&quot;,
      &quot;Eintracht Frankfurt&quot;: &quot;10&quot;,
      &quot;VfL Wolfsburg&quot;: &quot;11&quot;,
      &quot;1899 Hoffenheim&quot;: &quot;12&quot;,
      &quot;SC Freiburg&quot;: &quot;13&quot;,
      &quot;Hertha BSC&quot;: &quot;14&quot;,
      &quot;Arminia Bielefeld&quot;: &quot;15&quot;,
      &quot;1. FC Köln&quot;: &quot;16&quot;,
      &quot;FC Schalke 04&quot;: &quot;17&quot;,
      &quot;1. FSV Mainz 05&quot;: &quot;18&quot;,
  }
  player_ID_list = (32445, 31663, 31362, 32553) # Dummy list, in reality the list as around 500 elements
  
  Process = Process.Process()
  club_ranks = dictionary
  
  Process.multi_thread_load(player_ID_list, club_ranks)
  </code></pre>
  <p>As you can probably see I don't have much experience with python/coding yet, so if you see any further mistakes I make or know a better solution, I would appreciate those comments as well.</p>
  <p>Thanks!</p>