Everything You Always Wanted to Know About Async But Were Afraid to Ask (cit.) - PyCon Italia 2022
In this talk, we will dig in the marvelous world of sync/async/parallel computation. And show you how to define abstract computation upfront lazily using Promises, deferring execution subsequently and throttling the computation as you please. After this, async processing won’t have any secret to you I still remember when during an interview for a Junior Data Scientist position, I was asked about async and when to use it. I was buffled. And - I must say - after learning about these concepts, they are not that hard. Nevertheless, still mysterious to some. In this talk, after explaining some basic concepts about asynchronous processing and reviewing the most important Pythonic packages to be used in the async context, we will gently introduce some notions of functional programming and - most of all - one of its most useful tool for async operations: the Promise monad. Thanks to this, we will then be able to create, compose and chain abstract computations together, therefore defining what we want to do, without actually doing it yet. Acting lazily, its execution will rather be deferred to a second moment, where we will make use of async and parallel framework to speed up and parallelise execution. We will also show you how to throttle the execution, a need that often arises when dealing with rate-limited services and/or avoid overloading external component or resources. The talk will be accompanied by the help of a simple Github repo that will have examples and (hopefully) useful utility functions that will allow you to approach the asynchronous world more easily and seamlessly.