def _subscribe(self, observer):
        log.debug("HotObservable:subscribe()")

        observable = self
        self.observers.append(observer)
        self.subscriptions.append(Subscription(self.scheduler.clock))
        index = len(self.subscriptions) - 1

        def dispose_action():
            log.debug("HotObservable:subscribe:dispose_action(%s)" % self.scheduler.clock)
            observable.observers.remove(observer)
            start = observable.subscriptions[index].subscribe
            end = observable.scheduler.clock
            observable.subscriptions[index] = Subscription(start, end)

        return Disposable(dispose_action)
dataset/ETHPy150Open ReactiveX/RxPY/rx/testing/hotobservable.py/HotObservable._subscribe/original