def create_resource(): dispose_invoked[0] += 1 disposable[0] = MockDisposable(scheduler) return disposable[0]
def create_resource(): nonlocal disposable, dispose_invoked dispose_invoked += 1 disposable = MockDisposable(scheduler) return disposable