Here,
, we depend on a KeyError being raised from the pop operation on the idle pool, to branch into an alternative approach of forging a new connection.
If however KeyError were raised from other sources, due either to unforeseen problems with the code as-is or future developments of the Pool.get_connection method, this approach could go sideways, resulting in the new connection code being executed for potentially the wrong reasons.
if/else is more direct and less likely to fail.
See this PR to view the code changes being spoken of here.
Here,
python-irodsclient/irods/pool.py
Line 85 in d3cbda0
If however
KeyErrorwere raised from other sources, due either to unforeseen problems with the code as-is or future developments of thePool.get_connectionmethod, this approach could go sideways, resulting in the new connection code being executed for potentially the wrong reasons.if/else is more direct and less likely to fail.
See this PR to view the code changes being spoken of here.