promise

What is the Python equivalent of a Promise from JavaScript?

What is the Python equivalent of a Promise from JavaScript? Question: I am trying to understand what would be the best code structure or a design pattern that would do the following: Have a function named get_data that would start up a socket connection and will start waiting for a specific socket event that would …

Total answers: 1

Differences between Futures in Python3 and Promises in ES6

Differences between Futures in Python3 and Promises in ES6 Question: Since Python 3.5, the keywords await and async are introduced to the language. Now, I’m more of a Python 2.7 person and I have been avoiding Python 3 for quite some time so asyncio is pretty new to me. From my understanding it seems like …

Total answers: 2

How do I write a sequence of promises in Python?

How do I write a sequence of promises in Python? Question: Is it possible to write a sequence of promise (or tasks) using only Python 3.6.1 Standard Library? For example, a sequence promises in JavaScript is written as: const SLEEP_INTERVAL_IN_MILLISECONDS = 200; const alpha = function alpha (number) { return new Promise(function (resolve, reject) { …

Total answers: 3