title: How do I deal with a dictionary of objects that is constantly changing in Python?
body: <p>The current situation:
  I'm using Discord's API to retrieve a dictionary of member objects in my server. This dictionary is constantly changing in size as new members join and old members leave. </p>
  
  <p>I currently have a program that has a run time of around 30 minutes and accesses this dictionary of member objects so it's guaranteed that this dictionary changes size as I iterate over it in my program; this causes an error in my for loop. I also can't seem to <code>deepcopy</code> this dictionary;</p>
  
  <blockquote>
    <p>TypeError: can't pickle dict_values objects</p>
  </blockquote>
  
  <p>Any ideas of how I can work around this problem?</p>
  
  <p>Code:<br>
  <code>for i in members:
      do something;</code> &lt;--- while this is happening members changes in size<br>
  Trying this also doesn't work:<br>
      temp = copy.deepcopy(members)<br>
  This is what the dict is: dict_values([<code>&lt;discord.member.Member object at 0x1094b3268</code>>, <code>&lt;discord.member.Member object at 0x1094b32f0</code>>, etc</p>