GithubHelp home page GithubHelp logo

Missing Stub Async API about sinon HOT 4 OPEN

jonathan-benn avatar jonathan-benn commented on June 16, 2024
Missing Stub Async API

from sinon.

Comments (4)

note35 avatar note35 commented on June 16, 2024

I'm not sure if these are needed for Sinon.PY. What do you think?

This one need further research about the behavior of SinonJS's API and the demand of asynchronous programming in Python. (To be honest, I don't have ability to reply you Yes or No now.)

The keyword of async is available after python3.5. Previously, asynchronous programming could be implemented by gevent or coroutine in Python.

Another thing I have not considered here is thread-safe or not.


If you are interested in Asyncio in Python, I created a package to demo that, which is copied from keynote speaker David Beazley's talk at PyCon Brazil 2015.

from sinon.

note35 avatar note35 commented on June 16, 2024

AFAIK, the interpreter of javascript, such as v8 and browser, are designed with single thread(s) + async backend is an eventLoop

However, the interpreter of python, such as Cpython and Cython, are designed in totally different way. (It...almost need one or more semesters to explain.) Thus, for implementing this feature, there are several things need to research. (Also, the reason why I didn't implement this related function from SinonJS is same.)

from sinon.

jonathan-benn avatar jonathan-benn commented on June 16, 2024

Yes, JavaScript is 100% single-threaded, using an event loop. Python is based on C and is multi-threaded. To get an answer, I think we would need to understand why Sinon.JS has added these functions. What problem are they trying to solve?

from sinon.

note35 avatar note35 commented on June 16, 2024

Implementing #18 stub.callArg(argNum) and stub.callArgWith(argNum, [arg1, arg2, ...]) before this.

I will provide further investigation of this issue later.

from sinon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.