Giter Site home page Giter Site logo

learn_aiohttp's Introduction

learn_aiohttp and asyncio

Best explanation I've read so far is here: https://www.roguelynn.com/words/asyncio-we-did-it-wrong/

My take on understanding the async paradigm is:

In normal programming, we tell the computer what to do, and the order in which it should do it. ETL is the common example: we command the computer to extract some data, then transform it, then load it somewhere else. The transform step waits for the extract step, which waits for the load step.

Modern Async hinges on the concept of awaitables. The program instead starts the request (for example a network request), but instead of holding up program execution until the request has completed, we start doing something else, and only come back to the function dealing with the network request when the result of that function returns. In this sense, we 'await' the result of the network return.

Before awaitables in Python 3.5+, Async started with the concept of generators, because a generator by definition may have no end. If you inspect/slice the generator at its beginning, you're going to see a set of results produced, but there's no way you can wait for the generator to keep running before you perform the rest of your code - it will run forever. So in order to handle generators, Python developed some legacy Async concepts.

Now with awaitables, we define a coroutine with async def,

learn_aiohttp's People

Contributors

dvasdekis avatar

Watchers

James Cloos avatar

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.