Before the change, "Pool.borrow" was just returning the connection from the pool (and discarding the connections marked as closed), without doing additional network roundtrips.
It does not seem to be a design flaw to check the validity of the cursor's connection in the Cursor.__init__ method, as I did in my patch.
However it does not matter really, and your proposal looks good.
I've noticed another minor issue with your patch, because the `enumerate` built-in returns an iterable:
>>> the_pool = list('Python rocks!')
>>> for idx, char in enumerate(the_pool):
... print the_pool.pop(idx),
...
P t o o k !
>>>
Before the change, "Pool.borrow" was just returning the connection from the pool (and discarding the connections marked as closed), without doing additional network roundtrips.
It does not seem to be a design flaw to check the validity of the cursor's connection in the Cursor.__init__ method, as I did in my patch.
However it does not matter really, and your proposal looks good.
I've noticed another minor issue with your patch, because the `enumerate` built-in returns an iterable:
>>> the_pool = list('Python rocks!') the_pool) :
>>> for idx, char in enumerate(
... print the_pool.pop(idx),
...
P t o o k !
>>>