18 May
2016
18 May
'16
5:11 p.m.
On 05/18/2016 06:16 AM, Giampaolo Rodola' wrote:
On Wed, May 18, 2016 at 1:36 AM, Devin Jeanpierre wrote:
with contextlib.ExitStack() as exit_stack: if not bypass_lock: exit_stack.enter_context(RedisLock())
And similar.
In fact, ExitStack can itself be used as a no-op context manager, if you want.
I didn't think about this. So yeah, my proposal is useless. Nevermind.
Not at all. It's a good use-case, and it helped introduce/remind us about ExitStack (which I suspect is a hidden gem). So thank you all! :) -- ~Ethan~