mozilla/configman — comment on commit c5291a53afe6c5502370e6b82aa5f1f05bd881aa
File: demo/advanced_demo3.py line 309
By twobraids:

I think a better implementation would have been:
if force:
# ... stuff omitted for brevity
# now remove the connection from the pool if it is there
for name, conn in self.pool.iteritems():
if conn is connection:
del self.pool[name]
break
else:
# ... more omission

though, in Python 3, I believe that 'iteritems' is implemented in a way that it will break if the underlying dict changes during iteration. By doing the del within the loop, even though we're breaking the loop immediately thereafter, may be trouble. The existing implementation avoids that problem, but will delete the wrong connection if the target connection isnt' found.