"An event loop is when we let some stuff that takes a long time do it's thing in the background. And when it's all set, the 'event loop' will 'pick it up'." is the most helpful and intuitive definition of event loop I've heard.
I have so many questions. So, we have two functions running in the background, correct? And another main function, also known as the event loop, continuously monitors both functions for completion. Is it using threading to create worker threads to complete those tasks? And monitoring with the main thread? I kindly request clarification on these matters.
I really enjoy the fast-pace and the humor of your tutorials. Keeps me from zoning out. You've got a gift for making these tutorials both informative and enjoyable.
Fantastic video. I'm working on something for my internship that involves asyncio and aiohttp and this made it very easy to understand what is going on, you explain everything so well
@@PatrickAlphaC Processed 320k API with 100 APIs at a time. Out of 320k, 91 got connection error (404). When I rerun the remaining APIs, it worked. How to avoid this connection failure? It looks like a common issue in asyncio but dont see proper fix.
6:12 You could turn any synchronous (i.e. thread-blocking call) into an async one using the to_thread() function available in asyncio with Python 3.9 and later.
Dude, you have an amazing way for teaching things that in another way would result boring and complex. You've won a new and loyal subscriptor from Uruguay.
Finally understood how to implement asycio. Very well explained. You not trying to get everything correct in first attempt and giving errors so viewers can understand why it gave error was something very educational in this video. Subscribed.
Two things to remember when to use await. 1. You have to await to register the task to the event loop. 2. You have to await the coroutine to return the 'real response'.
The first job takes significant time, and this is why 11:27 method only diminished 4 seconds. (13s -> 9s) So when we do registering job all at once, it saves time and we could enjoy enormous time gain. (13s->1s)
Dude , thank you for the video , you made this so easy for me to understand how asyncio works , before I could not even begin to understand this concept
Came back to this when exploring MEV and monitoring the chain for certain txs. All the code I've seen uses JS and async/await so was curious on implementing it in python.
Great video. would be even better if you could also show how to control number of parallel requests. Uncontrolled parallel requests will trigger dos attack protections and block your further requests.
Great video, my only question would be is, how would you make it async if each time you made a call the url changed and there were headers involved in making the api request? Headers being content type and authentication
Well well well, to make tasks happen simultaneously, put them into an even_loop, just simple principle that i only understood after this video. The tutorial surprise my brain. Thank you!
I'm trying to understand how throwing tasks in an event loop by create_task in tasks list then gather the results(17:02) differs from just executing all tasks at once by gather method(16:38). It seems that gather method not only throws tasks in an event loop but also it executes and waits to be finished(?) so only difference from the two example is that whether you registered the tasks manually by adding create_task or just get them all done by gather method? Did i get it right?
@@PatrickAlphaC You mean as a built-in type? Python doesn’t have that, because it doesn’t need it. Remember that, unlike JavaScript, asyncio provides an API for wrapping alternative event loops, it doesn’t force you to use its default BaseEventLoop. For example, every GUI toolkit already provides its own event loop, and Python allows asyncio to work with that.
"An event loop is when we let some stuff that takes a long time do it's thing in the background. And when it's all set, the 'event loop' will 'pick it up'." is the most helpful and intuitive definition of event loop I've heard.
I have so many questions.
So, we have two functions running in the background, correct?
And another main function, also known as the event loop, continuously monitors both functions for completion.
Is it using threading to create worker threads to complete those tasks?
And monitoring with the main thread?
I kindly request clarification on these matters.
I really enjoy the fast-pace and the humor of your tutorials. Keeps me from zoning out. You've got a gift for making these tutorials both informative and enjoyable.
Appreciate it! I’m trying to find the right style. I get some people saying they hate it, and others love it. Guess time will tell ahah
@@PatrickAlphaC HA! So true. Well it is definitely different and different is refreshing! I just subscribed. Looking forward to more!
x2
Best async explanation in the burger loving world!!!
🙏🙏🙏
One of the greatest explanations of Async in TH-cam.
Wow! I hope this legend continues to provide such useful lessons for all of us.
I cant lie the creativity in explaining async is phenomenal.
Fantastic video. I'm working on something for my internship that involves asyncio and aiohttp and this made it very easy to understand what is going on, you explain everything so well
Usually i dont understand any of the programming video but this is by far the greatest explanation video ive ever watched
Incredible. Thank you so much. In the middle of a development that has 300,000 inevitable API calls. Let me check how it works. Again, Thank you
Good luck!
@@PatrickAlphaC Processed 320k API with 100 APIs at a time. Out of 320k, 91 got connection error (404). When I rerun the remaining APIs, it worked. How to avoid this connection failure? It looks like a common issue in asyncio but dont see proper fix.
Finally, someone who explained it in a language that I know the best FOODS!
Thank you for the tutorial, much love from Iran 😊😊
Dude this is the best explanation for asyncio that I've seen. I am surprised why this does not have enough views
really enjoyed the part where you shuttle between two pans to check if its done and in the process explaining the purpose event loop
Glad that was helpful!
I might make this video again...
Dude this is the most amusing programming tutorial I've seen in a while! Good stuff, you've got some acting skills
Glad it was fun and educational hehe
@@PatrickAlphaC I wish you made the whole course on that stuff
you have a skill for making tutorials very engaging. I didn't zone out for a sec
Yay :)
Glad it was helpful!
6:12 You could turn any synchronous (i.e. thread-blocking call) into an async one using the to_thread() function available in asyncio with Python 3.9 and later.
hot dog
Ayo this is the best clip I have ever witnessed about making api calls faster, props to u my man!!
Much obliged friend
Dude, you have an amazing way for teaching things that in another way would result boring and complex. You've won a new and loyal subscriptor from Uruguay.
ty fren
Finally understood how to implement asycio.
Very well explained.
You not trying to get everything correct in first attempt and giving errors so viewers can understand why it gave error was something very educational in this video. Subscribed.
didnt even zone out once, loving this....SUBSCRIBED
Ty Fren :)
I really really like this tutorial!! You made it really funny and enjoyable. Never had such a fun programming tutorial on youtube :D Keep going!
Thanks for the comment!
One of the best tutorials on Asyncio❤
wonder i completed 17mins tutorial without getting distracted. Great way of keeping audience on focus :)
It`s been less than 1 min of video and I already want to subscribe to his channel. Done.
Who says programmers aren't funny? Great Vid!
okay you are better than chatgpt.
the best tutorial on the internet, ever
Best video on aync I have ever seen. It is just like Tom cruise movie, you have to stick till end, twist may come any moment. Who knows😂
This is the best coding tutorial ever! Before finding it i was wondering what half of these things are. Now it's all clear, just like that! Thanks!
Perfect!!
I had to stop the video, to like and comment on this amazing explanation.
Thank you!
I didnt come here looking for an amazing channel. but here we are
😍😍😍
Best teacher i've ever seen. Really impressive
Glad it was helpful!
That was an AWESOME tutorial mate. Subscribed!
literally i don't feel like i am learning ASYNC, just feel like watching any comedy show..
hmm... thanks for the feedback
@@PatrickAlphaC you really make asyncio easy for me thanks
@@nonesubham oh ahahha
As a c++ guy, I can seriously appreciate this
i was having a hell of a time understanding async coding and this video really helped. Thank you! Take my sub :)
For more enquiries, reach out⬆️⬆️⬆️..
Wow! This is revolutionary technique in teaching how to code, to be honest it is better than the best tutorials here. Keep it up.
Glad it’s fun fren :)
For more enquiries, reach out⬆️⬆️⬆️..
One of the best asyncio tutorial!!
Thanks much Patrick!
this is the best tutorial i've watched on youtube. Surprisingly enjoyable for my pea brain
Glad you enjoyed fren :)
Hey Man, Thanks for the video.
using Tasks is a super duper and important way
this kind of guide, is life-altering. just amazing, man.
For a tricker topic Very Clearly Explained.
Thanks brother once again.
Dude please more more more where have you been my whole coding life.
I'm flattered beyond reason
Very informative. The cooking analogy was gold!
I watched many videos and read the docs but understandid the best from you
Glad to hear it :)
the video really cool and fun. and the code examples are really helpful. Thank you!
i'm so glad I found you.. Awesomeness !!
Two things to remember when to use await.
1. You have to await to register the task to the event loop.
2. You have to await the coroutine to return the 'real response'.
The first job takes significant time, and this is why 11:27 method only diminished 4 seconds. (13s -> 9s)
So when we do registering job all at once, it saves time and we could enjoy enormous time gain. (13s->1s)
@@jeffreylim5920 yea that's what he said lol...
Yes we need await before get_task(session)
Really amazing, so well explained and funny
This is greatest. I bow in front of you Sir!
This video makes me hungry and smarter at the same time.
yes
Your channel is going to blow up. Amazing explanation, keep up the good work
“Blow up” I hope you meant ;)
@@PatrickAlphaC ofcourse! ☺
Best explanation ever! Thanks!
Oh man what a fun video. You have definitely earned a sub mate!
Thank you!
Really loved this explanation!
I can't click enough on 'like' button. Thanks, your video was amazing!
Really Well explained and love the cooking. Subscribed. Very Fun to watch.
This is exactly what I was looking for. Thankss a ton
Beautiful!
you have nailed it !!!!
keep it up.
Patrick great job. I didn't skip even a second till end. I request you to make more interactive videos on python.
Glad you enjoyed, and I can do that!
12:19 I just ran the exact same code, it says RuntimeError: Event loop is closed. Win11,python 3.10.5
Great video Patrick! I wonder if you would make similar ones for threading, multi-processing and comparison of all concurrency features.
Great video my friend, await more_videos_please
Appropriate joke !
your video solved my issue! thanks! highly appreciated
Let's gooo!!
Oh Dude, I would love to see more tutorials done in this style! Super entertaining!
Dude , thank you for the video , you made this so easy for me to understand how asyncio works , before I could not even begin to understand this concept
good quality video right there. Synthetic and well explained. Good job man
Appreciate it! It’s a pretty tricky topic, so glad to hear it makes sense
The Best Video About AsyncIO I've Ever Seen! Thanks Man!
Glad to hear it!
Loved the tutorial. Thanks 👍
I like your energy and humor
I like you liking it
Great explanation, thank you!
It would be good too if you mention your learning process to grasp different topics
This is a HUGE part of it
th-cam.com/video/IS5dAkFSo_Y/w-d-xo.html
Great explanation! How will you deal with failed requests in the loop if you wanted to retry them?
@@kajairokajairo2271 you’d have to be clever about catching them, adding them to a new retry array, and trying again
@@PatrickAlphaC Thanks!
Cooking example was on point lol
Glad you enjoyed
amazing way of explanation with nicely chosen examples , you have a great teaching style man
Appreciate it! Hope it was helpful
Came back to this when exploring MEV and monitoring the chain for certain txs. All the code I've seen uses JS and async/await so was curious on implementing it in python.
Fantastic video dude, please share more advanced tips for Python like this!!
I'm a full-time JS web dev, and I was wondering recently what was the python approach of Promise.all()
Thank you so much, this is great content!!!
Great video. would be even better if you could also show how to control number of parallel requests. Uncontrolled parallel requests will trigger dos attack protections and block your further requests.
No, that would be confusing, considering the topic of the tutorial. A step-by-step (keep it simple) approach is preferable.
having that issue now
Great video, my only question would be is, how would you make it async if each time you made a call the url changed and there were headers involved in making the api request? Headers being content type and authentication
You'd have to do a lot more conditionals in the code 😅
Loved the video and the enunciation!
I call you on your Ordinary Sausage "ta da!" Well played
Man this video is Amazing 👏 I learned all about asyncio module in Python because of you Thank you 🙏
Awesome!! Glad it helped
The right terminology of *task is called spread instead of dereferencing. @ 15:36
It’s a kind of magic! Thank u!!!
Thank you for making this concept so straightforward!
give that man a cookie.
Well well well, to make tasks happen simultaneously, put them into an even_loop, just simple principle that i only understood after this video. The tutorial surprise my brain. Thank you!
Glad this is what helped it click!
I'm trying to understand how throwing tasks in an event loop by create_task in tasks list then gather the results(17:02) differs from just executing all tasks at once by gather method(16:38). It seems that gather method not only throws tasks in an event loop but also it executes and waits to be finished(?) so only difference from the two example is that whether you registered the tasks manually by adding create_task or just get them all done by gather method? Did i get it right?
This was a fun one!
Hello, how can we add rate limit in the aiohttp requests using the gather method?
Wow thank you so much Patrick
great explanation
Great stuff!
6:05 Fun fact: asyncio is written in pure Python. What was that about Python not being able to do event loops “natively”?
I meant more like javascript has the event loop as a first-class citizen.
@@PatrickAlphaC You mean as a built-in type? Python doesn’t have that, because it doesn’t need it.
Remember that, unlike JavaScript, asyncio provides an API for wrapping alternative event loops, it doesn’t force you to use its default BaseEventLoop. For example, every GUI toolkit already provides its own event loop, and Python allows asyncio to work with that.
Thanks for sharing ..
Great video...can you kindly explain how to get the candle data of the symbols in a dataframe/s...thnx
love the papa franku cameo
Rip pink guy
It was very useful thanks dude
Boom!
this was awesome 🔥
thank you so much for this great video ❤️🔥😇
🔥🔥🔥
Great explanation. Wasn't able to understand the documentation, but your video made it a lot clear.
Glad to help!
wow I leaned how to make a burger while cooking beans : )
That was the real take away