0
私はPythonで次のJavaScriptコードの例を翻訳してみました:RxPY - stop_and_waitの使い方は?
import Rx from "rx"
let source = Rx.Observable.interval(1000)
.timestamp()
.controlled();
source.stopAndWait().subscribe(
(result) => console.log("onNext: ", result),
(error) => console.log("onError: ", error),
() => console.log("Done!")
);
スニペットはRxJS Release Notesから取られました。私のPythonの解釈は、次のようになります。残念ながら
from __future__ import print_function
from rx import Observable
source = Observable.interval(1000).timestamp().controlled()
source.stop_and_wait().subscribe(
on_next=lambda x: print("on_next %s" % x),
on_error=lambda e: print("on_error %s" % e)
)
、JavaScriptのバージョンは、Pythonのバージョンが失敗しただけで正常に動作している間による「StopAndWaitObservable」オブジェクトが属性「サブスクリプション」を持っていないという事実に。